mirror of https://github.com/lukechilds/node.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
22 lines
515 B
22 lines
515 B
/**
|
|
* This method is the wrapper version of `_.flatMap`.
|
|
*
|
|
* @name flatMap
|
|
* @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();
|
|
}
|
|
|
|
module.exports = wrapperFlatMap;
|
|
|