Skip to content

Array Operations

List manipulation — chunk, flatten, group, map, reduce, zip, and more.

12 modules

ModuleDescription
Array ChunkSplit array into chunks of specified size
CompactRemove null/empty values from array
Array DifferenceFind elements in first array not in others
DropDrop first N elements from array
Array FlattenFlatten nested arrays into single array
Group ByGroup array elements by a key
Array IntersectionFind common elements between arrays
Array JoinJoin array elements into string
Array MapTransform each element in an array
Array ReduceReduce array to single value
TakeTake first N elements from array
Zip ArraysCombine multiple arrays element-wise

Modules

Array Chunk

array.chunk

Split array into chunks of specified size

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array of items to process. Can be numbers, strings, or objects.
sizenumberYes10Number of items per chunk

Output:

FieldTypeDescription
resultarrayArray of chunks
chunksnumberArray of chunks

Example: Chunk into groups of 3

yaml
array: [1, 2, 3, 4, 5, 6, 7, 8, 9]
size: 3

Example: Batch process items

yaml
array: ["a", "b", "c", "d", "e"]
size: 2

Compact

array.compact

Remove null/empty values from array

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array to compact
remove_empty_stringsbooleanNoTrueRemove empty strings
remove_zerobooleanNoFalseRemove empty strings
remove_falsebooleanNoFalseRemove zero values

Output:

FieldTypeDescription
resultarrayRemove false values
removednumberCompacted array

Array Difference

array.difference

Find elements in first array not in others

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array of items to process. Can be numbers, strings, or objects.
subtractarrayYes-Arrays containing items to remove from the base array

Output:

FieldTypeDescription
resultarrayElements unique to first array
lengthnumberElements unique to first array

Example: Find unique elements

yaml
array: [1, 2, 3, 4, 5]
subtract: [[2, 4], [5]]

Drop

array.drop

Drop first N elements from array

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Source array
countnumberYes1Source array

Output:

FieldTypeDescription
resultarrayNumber of elements to drop
droppednumberRemaining elements

Array Flatten

array.flatten

Flatten nested arrays into single array

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array of items to process. Can be numbers, strings, or objects.
depthnumberNo1How many levels of nesting to flatten (-1 for infinite)

Output:

FieldTypeDescription
resultarrayFlattened array
lengthnumberFlattened array

Example: Flatten one level

yaml
array: [[1, 2], [3, 4], [5, 6]]
depth: 1

Example: Flatten all levels

yaml
array: [[1, [2, [3, [4]]]]]
depth: -1

Group By

array.group_by

Group array elements by a key

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array of objects to group
keystringYes-Array of objects to group

Output:

FieldTypeDescription
groupsobjectProperty name to group by
keysarrayGrouped results
countnumberGrouped results

Array Intersection

array.intersection

Find common elements between arrays

Parameters:

NameTypeRequiredDefaultDescription
arraysarrayYes-Array of arrays to process (for intersection, union)

Output:

FieldTypeDescription
resultarrayCommon elements
lengthnumberCommon elements

Example: Find common elements

yaml
arrays: [[1, 2, 3, 4], [2, 3, 5], [2, 3, 6]]

Array Join

array.join

Join array elements into string

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array of items to process. Can be numbers, strings, or objects.
separatorselect (, , ,, , `
, , - `, ``)No,String to insert between items when joining

Output:

FieldTypeDescription
resultstringJoined string

Example: Join with comma

yaml
array: ["apple", "banana", "cherry"]
separator: ,

Example: Join with newline

yaml
array: ["Line 1", "Line 2", "Line 3"]
separator:

Array Map

array.map

Transform each element in an array

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array of items to process. Can be numbers, strings, or objects.
operationselect (multiply, add, subtract, divide, extract, uppercase, lowercase, trim, tostring, tonumber)Yes-Transformation to apply to each item
valueanyNo-Value for the operation: number for math operations, field name for extract

Output:

FieldTypeDescription
resultarrayTransformed array
lengthnumberTransformed array

Example: Multiply numbers

yaml
array: [1, 2, 3, 4, 5]
operation: multiply
value: 2

Example: Extract field from objects

yaml
array: [{"name": "Alice", "age": 30}, {"name": "Bob", "age": 25}]
operation: extract
value: name

Array Reduce

array.reduce

Reduce array to single value

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array of items to process. Can be numbers, strings, or objects.
operationselect (sum, product, average, min, max, count, join, first, last)Yes-How to combine all items into a single value
separatorselect (, , ,, , `
, , - `, ``)No,String to insert between items when joining

Output:

FieldTypeDescription
resultanyReduced value
operationstringReduced value

Example: Sum numbers

yaml
array: [1, 2, 3, 4, 5]
operation: sum

Example: Join strings

yaml
array: ["Hello", "World", "from", "Flyto"]
operation: join
separator:

Take

array.take

Take first N elements from array

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Source array
countnumberYes1Source array

Output:

FieldTypeDescription
resultarrayNumber of elements to take
lengthnumberTaken elements

Zip Arrays

array.zip

Combine multiple arrays element-wise

Parameters:

NameTypeRequiredDefaultDescription
arraysarrayYes-Array of arrays to zip
fill_valueanyNo-Array of arrays to zip

Output:

FieldTypeDescription
resultarrayValue for missing elements
lengthnumberZipped array

Released under the Apache 2.0 License.