Skip to content
This repository has been archived by the owner on Jan 10, 2024. It is now read-only.

testdouble/undermore

Repository files navigation

Undermore.js

Build Status

Undermore.js is an Underscore extension that adds a few methods to mixin.

Download the latest here.

New methods:

_.withoutProperties(object, iterator)

_.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(array)

_.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'}]