collect.js
Advanced tools
Comparing version 3.0.16 to 3.0.17
{ | ||
"name": "collect.js", | ||
"version": "3.0.16", | ||
"version": "3.0.17", | ||
"description": "Convenient and dependency free wrapper for working with arrays and objects.", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
'use strict'; | ||
module.exports = function every(fn) { | ||
return this.items.filter(fn).length === this.items.length; | ||
for (let i = 0; i < this.items.length; i++) { | ||
if (!fn(this.items[i])) { | ||
return false; | ||
} | ||
return true; | ||
} | ||
}; |
@@ -5,3 +5,9 @@ 'use strict'; | ||
if (typeof fn === 'function') { | ||
return this.items.filter(fn)[0]; | ||
for (let i = 0; i < this.items.length; i++) { | ||
const item = this.items[i]; | ||
if (fn(item)) { | ||
return item; | ||
} | ||
} | ||
return; | ||
} | ||
@@ -8,0 +14,0 @@ |
@@ -5,7 +5,8 @@ 'use strict'; | ||
if (Array.isArray(this.items)) { | ||
return ( | ||
this.items.filter(function(item) { | ||
return item.hasOwnProperty(key); | ||
}).length > 0 | ||
); | ||
for (let i = 0; i < this.items.length; i++) { | ||
if (this.items[i].hasOwnProperty(key)) { | ||
return true; | ||
} | ||
} | ||
return false; | ||
} | ||
@@ -12,0 +13,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
226270
2256