Security update for permissions_by_term
[yaffs-website] / node_modules / uncss / node_modules / lodash / flatMap.js
1 var arrayMap = require('./internal/arrayMap'),
2     baseFlatten = require('./internal/baseFlatten'),
3     baseIteratee = require('./internal/baseIteratee');
4
5 /**
6  * Creates an array of flattened values by running each element in `array`
7  * through `iteratee` and concating its result to the other mapped values.
8  * The iteratee is invoked with three arguments: (value, index|key, array).
9  *
10  * @static
11  * @memberOf _
12  * @category Array
13  * @param {Array} array The array to iterate over.
14  * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
15  * @returns {Array} Returns the new 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  */
25 function flatMap(array, iteratee) {
26   var length = array ? array.length : 0;
27   return length ? baseFlatten(arrayMap(array, baseIteratee(iteratee, 3))) : [];
28 }
29
30 module.exports = flatMap;