source: imaps-frontend/node_modules/lodash-es/flatMap.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: 810 bytes
Line 
1import baseFlatten from './_baseFlatten.js';
2import map from './map.js';
3
4/**
5 * Creates a flattened array of values by running each element in `collection`
6 * thru `iteratee` and flattening the mapped results. The iteratee is invoked
7 * with three arguments: (value, index|key, collection).
8 *
9 * @static
10 * @memberOf _
11 * @since 4.0.0
12 * @category Collection
13 * @param {Array|Object} collection The collection to iterate over.
14 * @param {Function} [iteratee=_.identity] The function invoked per iteration.
15 * @returns {Array} Returns the new flattened array.
16 * @example
17 *
18 * function duplicate(n) {
19 * return [n, n];
20 * }
21 *
22 * _.flatMap([1, 2], duplicate);
23 * // => [1, 1, 2, 2]
24 */
25function flatMap(collection, iteratee) {
26 return baseFlatten(map(collection, iteratee), 1);
27}
28
29export default flatMap;
Note: See TracBrowser for help on using the repository browser.