Nodes
Merge#
The Merge node combines two arrays into a single array. It takes two input arrays and outputs a new array containing all the elements from both input arrays in the order they were provided.
Inputs#
array1
(array): The first array to merge. Default value is an empty array.array2
(array): The second array to merge. Default value is an empty array.
Outputs#
result
(array): The merged array containing all elements fromarray1
followed by all elements fromarray2
.
Configuration#
This node has no additional configuration options.
Usage#
- Connect the first array to the
array1
input of the Merge node. - Connect the second array to the
array2
input of the Merge node. - The merged array will be available at the
result
output.
Example#
Suppose you have two arrays:
fruits
:["apple", "banana", "orange"]
vegetables
:["carrot", "broccoli"]
Connect fruits
to the array1
input and vegetables
to the array2
input of the Merge node. The result
output will be:
You can then use this merged array in other nodes of your spell.
Best Practices#
- Ensure that the data types of the elements in both input arrays are compatible. While the Merge node doesn't enforce strict type checking, unexpected behavior may occur if the elements have mismatched types.
- If you need to merge more than two arrays, you can chain multiple Merge nodes together, connecting the
result
output of one node to thearray1
input of the next.
Common Issues#
- If either of the input arrays is not connected or contains an invalid value, the Merge node will output an empty array.
- The Merge node does not remove duplicate elements. If the same element exists in both input arrays, it will appear twice in the output array.