# Map collection

Runs an expression for each item and returns the transformed collection.

Canonical URL: https://opennodeflow.dev/wiki/reference-app-core-core-map/
JSON reference: https://opennodeflow.dev/wiki/reference-app-core-core-map/index.json
Source snapshot: 2026-10-23

# Map collection

Evaluates a JavaScript expression for every item in an input array and returns a transformed collection. This is one node execution, not separate visual child flows.

## Sockets and configuration
- **exec** (control): optional execution gate.
- **items** (array, required): source collection.
- **items** (array): transformed results in original item order. **count** (number): result length.
- **next** (control): automatic success route.
- **expression** (string): default item; an empty expression also falls back to item.

## Expression behavior
The expression receives parameters **item** and **index** through new Function. It is an expression, so return object literals inside parentheses. It does not close over the node's inputs/config/context variables. Ordinary JavaScript globals remain available and code is trusted, not sandboxed.

## Example
With items `[{"kW":1.5},{"kW":2}]` and expression `({ ...item, watts: item.kW * 1000 })`, the result adds watts 1500 and 2000; count is 2. Empty arrays produce an empty result and count 0.

Promise.all awaits promise-valued results concurrently and preserves order; there is no per-item throttle or retry boundary. A rejected result or syntax error fails the whole node, and configured retries evaluate the entire collection again. Prefer pure expressions: external effects may be repeated and large/unbounded collections consume memory and timeout budget. This shipped wrapper does not itself use secrets, checkpoints or network, but an authored expression can execute host-accessible code. Returned values must remain JSON-transportable.

## Catalog identity

| Field | Value |
| --- | --- |
| Source key | `app.core.core.map` |
| Kind | node |
| Family | app-core |
| Pack | See library discovery |

[Integration guide](/wiki/first-workflow/) · [Browse the catalog](/wiki/integration-catalog/)

## Inputs

| Socket ID | Label | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `exec` | Execute | control | No |  |
| `items` | Items | array | Yes |  |

## Outputs

| Socket ID | Label | Type | Required | Meaning |
| --- | --- | --- | --- | --- |
| `next` | Next | control | No |  |
| `items` | Items | array | No |  |
| `count` | Count | number | No |  |

## Configuration schema


```json
{
  "type": "object",
  "properties": {
    "expression": {
      "type": "string",
      "title": "Item expression",
      "default": "item"
    }
  }
}
```





## Source and installed versions

This reference describes the maintained source catalog snapshot, not a live export of your installation. Published definitions use immutable versions; installed graphs retain their exact pins. Discover and read the installed definition and selected version before wiring it. See [versioning](/wiki/versioning/), [connections](/wiki/connections/) and [integration setup](/wiki/integration-setup/).

---

## Documentation provenance

- `../OpenNodeFlow-Library/work/catalog-all.mjs`
- `../OpenNodeFlow-Library/work/azure-pack-consolidation-20261022/catalog-policy.mjs`
- `../OpenNodeFlow-Library/work/developer-packs-20261022/catalog.mjs`
- `shared/seed.ts`
- `shared/storage-library.ts`
- `shared/variable-library.ts`
- `shared/control-flow.ts`
- `shared/remote-routes.ts`
- `server/runtime-library.ts`
- `shared/error-library.ts`
- `shared/storage-model.ts`
- `shared/builtin-documentation.ts`

This page describes maintained source, not a live inventory or an authorization to perform actions.
