@tempots/std

mapArray() function

Applies a function to each element of an array and returns a new array with the results.

Signature:

mapArray: (arr: A[], f: (a: A, index: number) => B) => B[]

Parameters

Parameter

Type

Description

arr

A[]

The input array.

f

(a: A, index: number) => B

The function to apply to each element.

Returns: B[]

The new array with the results of applying the function to each element.