Atom

collection.map()

Transforms each value.

Signature

collection.map(iterable, callback)

Parameters

Iterable and callback(value).

Returns

New array of callback results.

Behavior

Calls once per iterated value.

Errors

Iteration or callback error.

Example

Atom
use collection
func square(n):
    return n * n
assert(collection.map(1..4, square)[2] == 9)