Skip to main content

Map

A map-typed variable holds a JavaScript Map. The default value you type into the Variables panel is a JSON array of [key, value] pairs — for example [["key1","value1"],["key2","value2"]] — the same shape new Map(...) itself accepts. Anything that isn't a JSON array is rejected by the panel. At compile time, whatever array you typed is wrapped in new Map(...) for you.

Compiles to

let cache = new Map([
["key1", "value1"],
["key2", "value2"],
]);

Unlike most other types, leaving the default value empty still produces a real declarationnew Map() is constructed with no entries, rather than the variable being left undeclared. This holds even for a const (which normally skips its top-level declaration entirely when no default is given).

Get Variable / Set Variable

A Get cache node reads it back; a Set cache node assigns a new value and continues:

Get Variable

Set Variable

Use case

  • An in-memory lookup cache: keep small, request-scoped or module-scoped key/value state — for example memoizing a lookup by id — without reaching for a real database.