1 var baseFlatten = require('./_baseFlatten'),
2 map = require('./map');
5 * Creates an array of flattened values by running each element in `collection`
6 * through `iteratee` and concating its result to the other mapped values.
7 * The iteratee is invoked with three arguments: (value, index|key, collection).
11 * @category Collection
12 * @param {Array|Object} collection The collection to iterate over.
13 * @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
14 * @returns {Array} Returns the new flattened array.
17 * function duplicate(n) {
21 * _.flatMap([1, 2], duplicate);
24 function flatMap(collection, iteratee) {
25 return baseFlatten(map(collection, iteratee));
28 module.exports = flatMap;