//#region src/Array/flatMap.d.ts /** * # flatMap * * ```ts * function Array.flatMap( * target: readonly T[], * mapper: ( * value: NoInfer, * index: number, * target: readonly NoInfer[], * ) => U[], * ): readonly U[] * ``` * * Maps each element in `array` using the `mapper` function and flattens the result by one level. * * ## Example * * ```ts [data-first] * import { Array } from "@monstermann/array"; * * Array.flatMap([1, 2, 3], (x) => [x, x * 2]); // [1, 2, 2, 4, 3, 6] * ``` * * ```ts [data-last] * import { Array } from "@monstermann/array"; * * pipe( * [1, 2, 3], * Array.flatMap((x) => [x, x * 2]), * ); // [1, 2, 2, 4, 3, 6] * ``` * */ declare const flatMap: { (mapper: (value: NoInfer, index: number, target: readonly NoInfer[]) => U[]): (target: T[]) => U[]; (mapper: (value: NoInfer, index: number, target: readonly NoInfer[]) => U[]): (target: readonly T[]) => readonly U[]; (target: T[], mapper: (value: NoInfer, index: number, target: readonly NoInfer[]) => U[]): U[]; (target: readonly T[], mapper: (value: NoInfer, index: number, target: readonly NoInfer[]) => U[]): readonly U[]; }; //#endregion export { flatMap };