@utilify/core
Version:
Modern, strongly typed, and safe utility function library for JavaScript and TypeScript. Includes type checking, manipulation of arrays, objects, strings, dates, colors, numbers, regular expressions, and more. Compatible with Browser, Node.js, Deno, and B
10 lines • 487 B
TypeScript
/**
* Maps each array element and flattens the result one level.
* @template T,U
* @param {T[]} array - The array to map.
* @param {(value: T, index: number, array: T[]) => U | U[]} fn - The mapping function.
* @returns {U[]} The mapped and flattened array.
* @throws {TypeError} If array is not an array or fn is not a function.
*/
export default function flatMap<T, U>(array: T[], fn: (value: T, index: number, array: T[]) => U | U[]): U[];
//# sourceMappingURL=flatMap.d.ts.map