SocialluxSociallux
Toggle navigation menu
Docs navigationv

Primitive

array.project

BETA

Short name: project

Version: 1.0.0

Project each element of an array into a new object by mapping output keys to source path(s), with first-present fallback and defaults. Lets a read verb shape an atom list into display rows.

Back to primitive library

Inputs

KeyTypeRequiredDescription
arrayarraytrueArray of source objects to project.
fieldsarraytrueProjection specs. Each: { as: string, path?: string, firstOf?: string[], default?: any }. Use `path` for one source path, `firstOf` for an ordered fallback list; `default` is used when nothing is present.

Outputs

KeyTypeRequiredDescription
resultarrayfalseArray of projected objects, one per input element.