map

The map function can be used to transform the contents of an array. It's functions in a similar way to javascripts Array.prototype.map.

Examples

Simple addition

[1, 2, 3].map($this + 1)
// [2, 3, 4]

Extracting nested properties

[
    {"x": "foo"},
    {"x": "bar"},
    {"x": "baz"}
].map(x)
// ["foo", "bar", "baz"]

Fizzbuzz

Given numbers.json

{
    "numbers": [
        1, 2, 3, 4, 5,
        6, 7, 8, 9, 10,
        11, 12, 13, 14, 15
    ]
}

Last updated