Bump to v4.0.0.

This commit is contained in:
John-David Dalton
2015-09-17 17:52:09 -07:00
parent 1d77dfa4b7
commit 54e7baecc3
675 changed files with 11257 additions and 8085 deletions

30
flatMap.js Normal file
View File

@@ -0,0 +1,30 @@
import arrayMap from './internal/arrayMap';
import baseFlatten from './internal/baseFlatten';
import baseIteratee from './internal/baseIteratee';
/**
* Creates an array of flattened values by running each element in `array`
* through `iteratee` and concating its result to the other mapped values.
* The iteratee is invoked with three arguments: (value, index|key, array).
*
* @static
* @memberOf _
* @category Array
* @param {Array} array The array to iterate over.
* @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
* @returns {Array} Returns the new array.
* @example
*
* function duplicate(n) {
* return [n, n];
* }
*
* _.flatMap([1, 2], duplicate);
* // => [1, 1, 2, 2]
*/
function flatMap(array, iteratee) {
var length = array ? array.length : 0;
return length ? baseFlatten(arrayMap(array, baseIteratee(iteratee, 3))) : [];
}
export default flatMap;