Skip to main content

map()

map<T, R>(map): (arr) => R[]

Maps over the given array, calling the mapping function for each element. Returns a new array of the results.

Type Parameters

T

The type of array elements.

R

The return type of the mapping function.

Parameters

map

MapFn<T, R>

The mapping function to apply to each element of the array.

Returns

Function

Parameters

arr

T[]

Returns

R[]

Remarks

pure function

Example

import { map } from '@accelint/core';

map(x => x * 2)([1, 2, 3, 4, 5]);
// [2, 4, 6, 8, 10]