Array
Add an
newItem
to the end of an array.ARR_PUSH(stack: array[], newItem: any)
array[]
ARR_PUSH(["apples","pears"], "oranges")
Return value:
["apples","pears","oranges"]
Trim an array of elements bordered by indexes; optionally, can add new elements.
ARR_SPLICE(stack: array[], index: number, deleteCount: number, newItems?: any)
array[]
ARR_SPLICE(["apples","pears","oranges"], 0, 2, "bananas")
Return value:
["oranges","bananas"]
Returns a sum of all numeric values of Array elements.
ARR_SUM(stack: array[])
float
ARR_SUM([1, 2, 3])
Return value:
6
Returns second argument (as an expression) for each array element.
Variables item, index are available in the expression, representing listed item.
ARR_MAP(stack: array[], filter: expression)
array[]
ARR_MAP([{a:"hello", b:"bye"},{a:"hi", b:"see ya"}], item.a)
Return value:
["hello","hi"]
Return matched array pattern in comparison with the second expression argument.
Variables item, index are available in the expression, representing listed item.
ARR_FILTER(stack: array[], filter: expression => boolean)
array[]
ARR_FILTER(["hello","hi","how are you"], item == "hello")
Return value:
["hello"]
Reduces provided array by calling a second argument (as an expression).
Variable 'previousValue', 'currentValue' and 'currentIndex' are available in an expression.
ARR_REDUCE(stack: array, {previousValue || currentValue || currentIndex})
float
ARR_REDUCE([1, 2, 3, 4], previousValue + currentValue)
Return value:
10
Returns
array of indexes
for which the expression returns true
.Variable 'item' and 'index' are available in the expression.
ARR_FIND(stack: array, filter: expression)
array[]
ARR_FIND(["apples","pears","oranges"], item == "oranges")
Return value:
[2]
Returns
true
if an item is included in an array.INCLUDES(array: any, item: any)
boolean
INCLUDES([1,2,3],2)
Return value:
true
Last modified 1yr ago