source: imaps-frontend/node_modules/lodash-es/flatMapDeep.js

main
Last change on this file was d565449, checked in by stefan toskovski <stefantoska84@…>, 4 weeks ago

Update repo after prototype presentation

  • Property mode set to 100644
File size: 794 bytes
Line 
1import baseFlatten from './_baseFlatten.js';
2import map from './map.js';
3
4/** Used as references for various `Number` constants. */
5var INFINITY = 1 / 0;
6
7/**
8 * This method is like `_.flatMap` except that it recursively flattens the
9 * mapped results.
10 *
11 * @static
12 * @memberOf _
13 * @since 4.7.0
14 * @category Collection
15 * @param {Array|Object} collection The collection to iterate over.
16 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
17 * @returns {Array} Returns the new flattened array.
18 * @example
19 *
20 * function duplicate(n) {
21 * return [[[n, n]]];
22 * }
23 *
24 * _.flatMapDeep([1, 2], duplicate);
25 * // => [1, 1, 2, 2]
26 */
27function flatMapDeep(collection, iteratee) {
28 return baseFlatten(map(collection, iteratee), INFINITY);
29}
30
31export default flatMapDeep;
Note: See TracBrowser for help on using the repository browser.