Undermore.js is an Underscore extension that adds a few methods to mixin.
New methods:
_.withoutProperties
performs a shallow clone of the passed object
. It will invoke iterator
for each of object
's properties, and will delete properties for which iterator
returns true.
Example:
var person = { name: "Ted", email: "ted@veridian.com", company_id: 182 };
_(person).withoutProperties(function(value, key) {
return key.indexOf("_id") !== -1;
});
=> {name: "Ted", email: "ted@veridian.com"}
_.uniqual
is mostly like _.uniq, but performs comparisons with _.isEqual instead of ===.
Example:
var fruits = [{fruit:'apple'}, {fruit:'apple'}, {fruit: 'banana'}];
_(fruits).uniqual();
=> [{fruit:'apple'},{fruit:'banana'}]