You can prepare your own version of "not where" _.where , like this
_.mixin({ "notWhere": function(obj, attrs) { return _.filter(obj, _.negate(_.matches(attrs))); } });
And then you can write your code as follows
_.chain(listOfPlays) .where({ year: 1611 }) .notWhere({ author: 'Shakespeare' }) .value();
Note. _.negate is available only from version 1.1. So, if you are using the previous version of _ , you can do something like this
_.mixin({ "notWhere": function(obj, attrs) { var matcherFunction = _.matches(attrs); return _.filter(obj, function(currentObject) { return !matcherFunction(currentObject); }); } });
source share