collect.js
Advanced tools
Comparing version 3.0.9 to 3.0.10
{ | ||
"name": "collect.js", | ||
"version": "3.0.9", | ||
"version": "3.0.10", | ||
"description": "Convenient and dependency free wrapper for working with arrays and objects.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -264,53 +264,31 @@ 'use strict'; | ||
const comparisons = { | ||
'==': function (key, value) { | ||
return this.items.filter(function (item) { | ||
return item[key] == value; | ||
}); | ||
}.bind(this), | ||
return new Collection( | ||
this.items.filter(function(item) { | ||
switch (operator) { | ||
case '==': | ||
return item[key] == value; | ||
'===': function (key, value) { | ||
return this.items.filter(function (item) { | ||
return item[key] === value; | ||
}); | ||
}.bind(this), | ||
case '===': | ||
return item[key] === value; | ||
'!=': function (key, value) { | ||
return this.items.filter(function (item) { | ||
return item[key] != value; | ||
}); | ||
}.bind(this), | ||
case '!=': | ||
return item[key] != value; | ||
'!==': function (key, value) { | ||
return this.items.filter(function (item) { | ||
return item[key] !== value; | ||
}); | ||
}.bind(this), | ||
case '!==': | ||
return item[key] !== value; | ||
'<': function (key, value) { | ||
return this.items.filter(function (item) { | ||
return item[key] < value; | ||
}); | ||
}.bind(this), | ||
case '<': | ||
return item[key] < value; | ||
'<=': function (key, value) { | ||
return this.items.filter(function (item) { | ||
return item[key] <= value; | ||
}); | ||
}.bind(this), | ||
case '<=': | ||
return item[key] <= value; | ||
'>': function (key, value) { | ||
return this.items.filter(function (item) { | ||
return item[key] > value; | ||
}); | ||
}.bind(this), | ||
case '>': | ||
return item[key] > value; | ||
'>=': function (key, value) { | ||
return this.items.filter(function (item) { | ||
return item[key] >= value; | ||
}); | ||
}.bind(this) | ||
}; | ||
return new Collection(comparisons[operator](key, value)); | ||
case '>=': | ||
return item[key] >= value; | ||
} | ||
}) | ||
); | ||
}; | ||
@@ -317,0 +295,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
218295
2042