1 var arrayMap = require('./internal/arrayMap'),
2 baseFlatten = require('./internal/baseFlatten'),
3 baseIteratee = require('./internal/baseIteratee');
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).
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.
18 * function duplicate(n) {
22 * _.flatMap([1, 2], duplicate);
25 function flatMap(array, iteratee) {
26 var length = array ? array.length : 0;
27 return length ? baseFlatten(arrayMap(array, baseIteratee(iteratee, 3))) : [];
30 module.exports = flatMap;