Skip to content

Instantly share code, notes, and snippets.

@bobpace
Created March 18, 2015 23:44
Show Gist options
  • Save bobpace/dd65ce47f3292b9eb5bd to your computer and use it in GitHub Desktop.
Save bobpace/dd65ce47f3292b9eb5bd to your computer and use it in GitHub Desktop.
Flatmap for lodash
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