Array Functions¶
Quick Reference¶
| Function | Description |
|---|---|
ARRAY_APPEND | Returns a new array with the specified element appended to t... |
ARRAY_CONTAINS | Returns true if the array contains the specified element. |
ARRAY_DISTINCT | Returns a new array with duplicate elements removed, preserv... |
ARRAY_EVERY | Returns true if all elements have the specified property equ... |
ARRAY_FILTER | Filters array elements using a lambda predicate or property ... |
ARRAY_FIND | Finds the first element where the specified property equals ... |
ARRAY_FIND_INDEX | Finds the index of the first element where the specified pro... |
ARRAY_FLATTEN | Flattens a nested array by one level. |
ARRAY_JOIN | Joins array elements into a single string with the specified... |
ARRAY_LENGTH | Returns the number of elements in the given array. |
ARRAY_MAP | Transforms array elements using a lambda or extracts a prope... |
ARRAY_PREPEND | Returns a new array with the specified element prepended to ... |
ARRAY_REDUCE | Reduces array to a single value by summing all numeric eleme... |
ARRAY_REMOVE | Returns a new array with all occurrences of the specified el... |
ARRAY_REVERSE | Returns a new array with elements in reverse order. |
ARRAY_SLICE | Returns a portion of the array from start index to end index... |
ARRAY_SOME | Returns true if at least one element has the specified prope... |
ARRAY_SORT | Returns a new array sorted by the specified property (ascend... |
Function Details¶
ARRAY_APPEND¶
Returns a new array with the specified element appended to the end.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to append to |
element | ANY | The element to append |
Returns: ARRAY - A new array with the element appended
Examples:
ARRAY_CONTAINS¶
Returns true if the array contains the specified element.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to search |
element | ANY | The element to search for |
Returns: BOOLEAN - True if the array contains the element, otherwise false
Examples:
ARRAY_DISTINCT¶
Returns a new array with duplicate elements removed, preserving original order.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to deduplicate |
Returns: ARRAY - A new array with duplicates removed
Examples:
ARRAY_EVERY¶
Returns true if all elements have the specified property equal to the given value.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to check |
property | STRING | The property name to check |
value | ANY | The value to match |
Returns: BOOLEAN - True if all match
ARRAY_FILTER¶
Filters array elements using a lambda predicate or property matching.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to filter |
predicateOrProperty | ANY | A lambda (x) => boolean or property name |
value | ANY | Value to match (only for property mode) |
Returns: ARRAY - Filtered array
Examples:
ARRAY_FIND¶
Finds the first element where the specified property equals the given value.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to search |
property | STRING | The property name to check |
value | ANY | The value to match |
Returns: ANY - The first matching element, or null
ARRAY_FIND_INDEX¶
Finds the index of the first element where the specified property equals the given value.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to search |
property | STRING | The property name to check |
value | ANY | The value to match |
Returns: NUMBER - The index of the first match, or -1
ARRAY_FLATTEN¶
Flattens a nested array by one level.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The nested array to flatten |
Returns: ARRAY - The flattened array
Examples:
ARRAY_JOIN¶
Joins array elements into a single string with the specified delimiter.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to join |
delimiter | STRING | The delimiter to use between elements |
Returns: STRING - The joined string
Examples:
ARRAY_LENGTH¶
Returns the number of elements in the given array.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array whose length is to be determined |
Returns: INTEGER - The length of the array
Examples:
ARRAY_MAP¶
Transforms array elements using a lambda or extracts a property.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to transform |
mapperOrProperty | ANY | A lambda (x) => expr or property name |
Returns: ARRAY - Array of transformed values
Examples:
ARRAY_PREPEND¶
Returns a new array with the specified element prepended to the beginning.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to prepend to |
element | ANY | The element to prepend |
Returns: ARRAY - A new array with the element prepended
Examples:
ARRAY_REDUCE¶
Reduces array to a single value by summing all numeric elements (or concatenating strings).
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to reduce |
initial | ANY | The initial accumulator value |
Returns: ANY - The reduced value
Examples:
ARRAY_REMOVE¶
Returns a new array with all occurrences of the specified element removed.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to remove elements from |
element | ANY | The element to remove |
Returns: ARRAY - A new array with the element removed
Examples:
ARRAY_REVERSE¶
Returns a new array with elements in reverse order.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to reverse |
Returns: ARRAY - The reversed array
Examples:
ARRAY_SLICE¶
Returns a portion of the array from start index to end index (exclusive).
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to slice |
start | NUMBER | The start index (inclusive) |
end | NUMBER | The end index (exclusive) |
Returns: ARRAY - The sliced portion of the array
Examples:
ARRAY_SOME¶
Returns true if at least one element has the specified property equal to the given value.
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to check |
property | STRING | The property name to check |
value | ANY | The value to match |
Returns: BOOLEAN - True if any match
ARRAY_SORT¶
Returns a new array sorted by the specified property (ascending).
Parameters:
| Name | Type | Description |
|---|---|---|
array | ARRAY | The array to sort |
property | STRING | The property name to sort by (optional for primitive arrays) |
Returns: ARRAY - The sorted array