Files
lodash/wrapperFlatMap.js
John-David Dalton 8c26e6fd4c Bump to v4.0.0.
2016-01-13 01:10:19 -08:00

26 lines
570 B
JavaScript

define([], function() {
/**
* This method is the wrapper version of `_.flatMap`.
*
* @static
* @memberOf _
* @category Seq
* @param {Function|Object|string} [iteratee=_.identity] The function invoked per iteration.
* @returns {Object} Returns the new `lodash` wrapper instance.
* @example
*
* function duplicate(n) {
* return [n, n];
* }
*
* _([1, 2]).flatMap(duplicate).value();
* // => [1, 1, 2, 2]
*/
function wrapperFlatMap(iteratee) {
return this.map(iteratee).flatten();
}
return wrapperFlatMap;
});