source: trip-planner-front/node_modules/lodash/flatMapDeep.js@ eed0bf8

Last change on this file since eed0bf8 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 796 bytes
RevLine 
[6a3a178]1var baseFlatten = require('./_baseFlatten'),
2 map = require('./map');
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
31module.exports = flatMapDeep;
Note: See TracBrowser for help on using the repository browser.