UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

28 lines (26 loc) 720 B
import { ArrayMap } from "./internals/types.js"; //#region src/array/mapEach.d.ts /** * `mapEach(array, mapper)` * * Applies the `mapper` function to each element in `array`, returning a new array with the mapped elements. * * ```ts * mapEach([1, 2, 3, 4], (x) => x * 2); // [2, 4, 6, 8] * ``` * * ```ts * pipe( * [1, 2, 3, 4], * mapEach((x) => x * 2), * ); // [2, 4, 6, 8] * ``` */ declare const mapEach: { <T, U>(mapper: ArrayMap<T, U>): (target: T[]) => U[]; <T, U>(mapper: ArrayMap<T, U>): (target: readonly T[]) => readonly U[]; <T, U>(target: T[], mapper: ArrayMap<T, U>): U[]; <T, U>(target: readonly T[], mapper: ArrayMap<T, U>): readonly U[]; }; //#endregion export { mapEach };