🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

collect.js

Package Overview
Dependencies
Maintainers
1
Versions
149
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

collect.js - npm Package Compare versions

Comparing version

to
3.0.10

2

package.json
{
"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 @@