UNPKG

es-toolkit

Version:

A state-of-the-art, high-performance JavaScript utility library with a small bundle size and strong type annotations.

20 lines (19 loc) 691 B
const require_flatMapDepth = require("./flatMapDepth.js"); //#region src/compat/array/flatMapDeep.ts /** * Creates a flattened array of values by running each element through iteratee and recursively flattening the mapped results. * * @template T, R * @param collection - The array or object to iterate over. * @param [iteratee] - The function that produces the new array elements. * @returns A new array that has been deeply flattened. * * @example * flatMapDeep([1, 2, 3], n => [[n, n]]); * // => [1, 1, 2, 2, 3, 3] */ function flatMapDeep(collection, iteratee) { return require_flatMapDepth.flatMapDepth(collection, iteratee, Infinity); } //#endregion exports.flatMapDeep = flatMapDeep;