Skip to content

Instantly share code, notes, and snippets.

@lsongdev
Last active August 29, 2015 14:09
Show Gist options
  • Select an option

  • Save lsongdev/0ff3d3414fc429b04733 to your computer and use it in GitHub Desktop.

Select an option

Save lsongdev/0ff3d3414fc429b04733 to your computer and use it in GitHub Desktop.
underscore-extend.js
_.mixin({
// Return a copy of the object containing all but the blacklisted properties.
unpick: function (obj) {
return _.pick(obj, _.difference(_.keys(obj), _.flatten(Array.prototype.slice.call(arguments, 1))));
},
average: function (arr) {
return _.reduce(arr, function(memo, num){
return memo + num;
}, 0) / arr.length;
}
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment