Extracts x elements from an array
summary (oneliner)
Creates a new array with Chunk Size
elements starting from Start Index
, copies the values from the input array (shallow copy).
If there are less elements in the array than Chunk Size
, the size of the output array may be smaller.
*Example 1: *
- Input Array:
1, 2, 3, 4, 5
- Start Index:
2
- Chunk Size:
3
- Output Array:
3, 4, 5
*Example 2: *
- Input Array:
1, 2, 3, 4, 5
- Start Index:
3
- Chunk Size:
3
- Output Array:
4, 5
ArrayChunk has a special mode – Circular
– when set to true
, elements from the beginning of the array will be included:
Example 3:
- Input Array:
1, 2, 3
- Start Index:
1
- Chunk Size:
3
- Circular:
true
- Output Array:
2, 3, 1
doc
issues
youtube id
caniuse query
collections
Inputs
Input Array (Array)
The array to get a chunk out of
Begin Index (integer /Number)
The index where the chunk should begin
Chunk Size (integer /Number)
How big the chunk should be, if there are not enough elements at the end of the Input Array
the chunk will be smaller
Circular (boolean /Number)
If true, values from the beginning will be taken when end reached
Outputs
Output Array (Array)
Included Chunk Size
elements or less
Array length (Number)