UNPKG

@monstermann/fn

Version:

A utility library for TypeScript.

39 lines (37 loc) 1.43 kB
import { ArrayGuard, ArrayMap, ArrayPredicate } from "./internals/types.js"; //#region src/array/findMapAll.d.ts /** * `findMapAll(array, predicate, mapper)` * * Finds all elements in `array` that satisfy the provided `predicate` function and applies the `mapper` function to each of them, returning a new array with the mapped elements. * * ```ts * findMapAll( * [1, 2, 3, 4], * (x) => x > 2, * (x) => x * 10, * ); // [1, 2, 30, 40] * ``` * * ```ts * pipe( * [1, 2, 3, 4], * findMapAll( * (x) => x > 2, * (x) => x * 10, * ), * ); // [1, 2, 30, 40] * ``` */ declare const findMapAll: { <T, U extends T>(predicate: ArrayGuard<T, U>, mapper: ArrayMap<T>): (target: T[]) => T[]; <T, U extends T>(predicate: ArrayGuard<T, U>, mapper: ArrayMap<T>): (target: readonly T[]) => readonly T[]; <T>(predicate: ArrayPredicate<T>, mapper: ArrayMap<T>): (target: T[]) => T[]; <T>(predicate: ArrayPredicate<T>, mapper: ArrayMap<T>): (target: readonly T[]) => readonly T[]; <T, U extends T>(target: T[], predicate: ArrayGuard<T, U>, mapper: ArrayMap<T>): T[]; <T, U extends T>(target: readonly T[], predicate: ArrayGuard<T, U>, mapper: ArrayMap<T>): readonly T[]; <T>(target: T[], predicate: ArrayPredicate<T>, mapper: ArrayMap<T>): T[]; <T>(target: readonly T[], predicate: ArrayPredicate<T>, mapper: ArrayMap<T>): readonly T[]; }; //#endregion export { findMapAll };