Created
March 18, 2015 23:44
-
-
Save bobpace/dd65ce47f3292b9eb5bd to your computer and use it in GitHub Desktop.
Flatmap for lodash
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var _ = require('lodash'); | |
module.exports.apply = function lodashFlatMapMixin() { | |
function flatMap (array, selector) { | |
return [].concat.apply([], array.map(selector)); | |
}; | |
_.mixin({flatMap: flatMap}, {chain: true}); | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment