Skip to content

mapAt

mapAt(array, index, mapper)

Applies the mapper function to the element at the specified index in array, returning a new array with the mapped element.

ts
mapAt([1, 2, 3, 4], 1, (x) => x * 10); // [1, 20, 3, 4]
ts
pipe(
    [1, 2, 3, 4],
    mapAt(1, (x) => x * 10),
); // [1, 20, 3, 4]