Skip to content

Array Map

What It Does

Transforms each item in a list by applying the same operations to every element. It runs a mini-graph for each item in your list and collects the results into a new list of the same length.

Inputs

NameDescriptionTypeRequired
arrayThe list to process each itemListYes
Dynamic inputsAny inputs you add to the inner graph will appear hereVariesNo

Outputs

NameDescriptionType
valueThe resulting list after processing each itemList

Array Map Example

Inner Graph Special Inputs

NameDescriptionType
valueThe current array item being processedAny
indexThe current position in the arrayNumber
lengthThe total length of the arrayNumber

Inner Graph Required Output

NameDescriptionType
valueThe transformed value to include in the result arrayAny

How to Use It

  1. Drag the Array Map node into your graph.
  2. Connect your list (like [2, 4, 6, 8, 10]) to the "array" input.
  3. Click on the 'Subgraph Explorer' the node to open the inner graph editor.
  4. Inside the inner graph, build your transformation logic using the "value" input.
  5. In this example we connect the "value" to a "Multiply" node and multiply by 100.
  6. Connect your transformed result to the "value" output on the Output node.
  7. Return to the main graph, right click on the "Array Map" and click on "Force Execute" to ensure the inner graph is run on each item in the array. The output will be an array with the operation done on each item in the array.

Tips

  • The inner graph runs once for each item in the array, in order.
  • You can add your own inputs to the inner graph's Input node, which will appear as inputs on the main Array Map node.
  • Use "index" inside the inner graph to access the position of the current item being processed.
  • The resulting array will always have the same length as the input array.

See Also

  • Array Filter: For selecting only specific items from a list rather than transforming all of them.
  • Array Find: For finding a single item in an array based on custom criteria.

Use Cases

  • Color Palette Generation: Transform a list of base colors by applying the same adjustments to each.
  • Scaling Values: Convert all measurements in a list by applying the same mathematical operations.
  • Token Transformation: Process each design token in a collection to add or modify properties consistently.