Array Nodes

> Work with ordered lists of values -- create arrays, add and remove elements, search, sort, and iterate.

Array nodes let you build and manipulate lists in your flow. Arrays in Brickr use a typed format: a string:array is an array of strings, a number:array is an array of numbers, and so on. The generic array type holds elements of any type.

The X:array type format is used throughout Brickr to describe typed arrays. For example, a node that outputs object:array produces a list of objects. This type information helps the editor suggest compatible connections.

Creating Arrays

create-array

Creates a new empty array.

| Pin | Direction | Type | |-----|-----------|------| | array | Output | array |

make-array

Creates a new array from individual input values. The node has dynamic inputs -- you can add as many elements as you need.

| Pin | Direction | Type | |-----|-----------|------| | element_0 | Input | any | | element_1 | Input | any | | ... | Input | any | | array | Output | any:array |

array-range

Creates an array of numbers within a specified range.

| Pin | Direction | Type | |-----|-----------|------| | start | Input | number | | end | Input | number | | step | Input | number | | result | Output | number:array |

array-fill

Creates an array of a specified length filled with a given value.

| Pin | Direction | Type | |-----|-----------|------| | value | Input | any | | length | Input | number | | result | Output | any:array |

Accessing Elements

get-array-item

Returns the element at the specified index.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | index | Input | number | | element | Output | any |

get-array-length

Returns the number of elements in the array.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | length | Output | number |

get-random-array-item

Returns a randomly selected element from the array.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | element | Output | any |

extract-array-values

Extracts values from an array of objects by a specified key, returning a flat array of those values.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | object:array | | key | Input | string | | result | Output | any:array |

Adding Elements

add-to-array

Adds an element to the end of an array and returns the new array.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | element | Input | any | | result | Output | any:array |

array-insert

Inserts an element at a specific index in the array.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | index | Input | number | | element | Input | any | | result | Output | any:array |

array-unshift

Adds an element to the beginning of an array.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | element | Input | any | | result | Output | any:array |

array-concat

Concatenates two arrays into one.

| Pin | Direction | Type | |-----|-----------|------| | a | Input | any:array | | b | Input | any:array | | result | Output | any:array |

Removing Elements

remove-array-item

Removes an element at the specified index from the array.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | index | Input | number | | result | Output | any:array |

array-pop

Removes the last element from an array.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | result | Output | any:array | | popped | Output | any |

array-shift

Removes the first element from an array.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | result | Output | any:array | | shifted | Output | any |

array-clear

Returns an empty array, effectively clearing all elements.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | result | Output | any:array |

Modifying Elements

array-set-item

Returns a new array with the element at the specified index replaced.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | index | Input | number | | value | Input | any | | result | Output | any:array |

array-resize

Resizes an array to a specified length, truncating or padding as needed.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | length | Input | number | | result | Output | any:array |

Slicing and Reordering

array-slice

Returns a shallow copy of a portion of the array between start and end indices.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | start | Input | number | | end | Input | number | | result | Output | any:array |

array-reverse

Returns a new array with the elements in reverse order.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | result | Output | any:array |

array-sort

Returns a new array with elements sorted.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | result | Output | any:array |

array-flatten

Flattens nested arrays into a single-level array.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | result | Output | any:array |

array-unique

Returns a new array with duplicate elements removed.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | result | Output | any:array |

Searching

array-contains

Returns true if the array contains the given element.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | element | Input | any | | result | Output | boolean |

array-find-index

Returns the index of the first element that matches the given value, or -1 if not found.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | element | Input | any | | index | Output | number |

array-last-index

Returns the index of the last element that matches the given value, or -1 if not found.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | element | Input | any | | index | Output | number |

Testing Elements

array-every

Returns true if every element satisfies the condition defined by the inner flow.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | currentItem | Output (loop body) | any | | condition | Input (loop body) | boolean | | result | Output | boolean |

array-some

Returns true if at least one element satisfies the condition.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | currentItem | Output (loop body) | any | | condition | Input (loop body) | boolean | | result | Output | boolean |

Transforming

filter-array

Creates a new array containing only elements that satisfy the condition.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | currentItem | Output (loop body) | any | | condition | Input (loop body) | boolean | | result | Output | any:array |

Use filter-array to remove unwanted items from API responses, database results, or user-provided lists before further processing.

array-join

Joins all elements of an array into a string, separated by the specified separator.

| Pin | Direction | Type | |-----|-----------|------| | array | Input | any:array | | separator | Input | string | | result | Output | string |

Set Operations

array-union

Returns a new array containing all unique elements from both input arrays.

| Pin | Direction | Type | |-----|-----------|------| | a | Input | any:array | | b | Input | any:array | | result | Output | any:array |

array-intersection

Returns a new array containing only elements that exist in both input arrays.

| Pin | Direction | Type | |-----|-----------|------| | a | Input | any:array | | b | Input | any:array | | result | Output | any:array |

array-difference

Returns a new array containing elements that exist in the first array but not in the second.

| Pin | Direction | Type | |-----|-----------|------| | a | Input | any:array | | b | Input | any:array | | result | Output | any:array |

Iteration

for-each-array

Executes a sequence of nodes once for each element in an array.

| Pin | Direction | Type | |-----|-----------|------| | sequence in | Input | sequence | | array | Input | any:array | | currentItem | Output (loop body) | any | | currentIndex | Output (loop body) | number | | loop body | Output | sequence | | completed | Output | sequence |

for-each-array is a sequence node -- it requires a sequence connection to run. Use it when you need to perform side effects (like database inserts or HTTP requests) for each element. For pure transformations, prefer filter-array instead.

for-each-array-break

Same as for-each-array but supports early termination. When the break condition is met, the loop stops and execution continues from the completed output.

| Pin | Direction | Type | |-----|-----------|------| | sequence in | Input | sequence | | array | Input | any:array | | currentItem | Output (loop body) | any | | currentIndex | Output (loop body) | number | | break | Input (loop body) | boolean | | loop body | Output | sequence | | completed | Output | sequence |

Use for-each-array-break when you need to stop processing early, such as finding the first matching item and then exiting the loop.