Maps the top-level properties of an object through a map function.
That is, run each of the values of an object through a function,
setting the result onto the same key structure as original.
It is NOT recursive.
The mapping function gets a single args object, consisting of { value, field, index },
where 'value' is the value of the field, 'field' the name, and 'index' a numeric count.
Maps the top-level properties of an object through a map function. That is, run each of the values of an object through a function, setting the result onto the same key structure as original.
It is NOT recursive.
The mapping function gets a single args object, consisting of
{ value, field, index }
, where 'value' is the value of the field, 'field' the name, and 'index' a numeric count.Example: Double the value of all fields
Since the map callback gets the name of the property, it can do context-dependent things.
In addition to bulk processing, it allows remapping of property types.
In terms of type-safety, the mapped properties are assumed to have the same type.