|
reject
Overview of reject
found in select.js rejectAction that rejects objects from an array depending on the result of the decider. This is the opposite of select. Usageobjx( array ).reject( decider [, behaviour);
Examplevar selectTestObjects = [
{ name: "Mat", age: 26 },
{ name: "Simon", age: 23 },
{ name: "Laurie", age: 25 },
{ name: "Chris", age: 21 },
{ name: "Corey", age: 1 }
];
// select objects whose age is NOT below 22
objx(selectTestObjects).reject({age: {below: 22}}, ONew);
// returns [{ name: "Mat", age: 26 }, { name: "Simon", age: 23 }, { name: "Laurie", age: 25 }]
// select objects whose name DOESN'T begin with `C`
objx(selectTestObjects).reject(function(n){ return n.name.substr(0,1)=="C"; }}, ONew);
// returns [{ name: "Mat", age: 26 }, { name: "Simon", age: 23 }, { name: "Laurie", age: 25 }]See alsoreject is bundled with the select plugin and works as the exact opposite. | ||||||
► Sign in to add a comment