map

Iterate over all properties on a thing.

Be aware that the order when iterating over a thing is not guaranteed.

This function does not generate an event.

Function

thing.map(callback)

Arguments

Explanation of the callback argument:

Iterable Arguments Description
thing name, value Iterate over the thing properties. Both name and value are optional.

Return value

A new list with each element being the result of the callback function.

Example

This code shows an example using map():

user = {name: "Iris", age: 6};

user.map(|property| property.len());

Return value in JSON format

[
    4,
    3
]