map

Map array items with a small arrow-function expression.

Syntax

{{ value | map:item => item.name }}{{ value | map:item => ({name: item.name}) }}

Example

01

Basic usage

InputTS
1{2  "people": [3    {4      "name": "Ada"5    },6    {7      "name": "Lin"8    }9  ]10}
TemplateKNAP
1{{ people | map:person => person.name }}
OutputKNAP
1["Ada","Lin"]

Behavior

  • The expression can select nested properties or construct a small object.