Comparing version 1.2.0 to 1.3.0
15
index.js
@@ -1,2 +0,2 @@ | ||
Collection = { | ||
const Collection = { | ||
isEmpty() { return this.length === 0; }, | ||
@@ -6,2 +6,10 @@ notEmpty() { return !this.isEmpty(); }, | ||
last() { return this[this.length-1]; }, | ||
any(predicate) { | ||
for (let elem in this) | ||
if (predicate(this[elem])) return true; | ||
return false; | ||
}, | ||
all(predicate) { | ||
return !this.any(elem => !predicate(elem)); | ||
} | ||
}; | ||
@@ -15,4 +23,5 @@ | ||
Object.keys(Collection).forEach(function (methodName) { | ||
Array.prototype[methodName] = Collection[methodName]; | ||
String.prototype[methodName] = Collection[methodName]; | ||
[Array.prototype, String.prototype].forEach(function (proto) { | ||
Object.defineProperty(proto, methodName, { value: Collection[methodName] }); | ||
}); | ||
}); |
{ | ||
"name": "oow", | ||
"version": "1.2.0", | ||
"version": "1.3.0", | ||
"description": "Extension methods that should exist in JS core by default", | ||
@@ -12,3 +12,3 @@ "homepage": "https://github.com/ngarbezza/oow", | ||
"scripts": { | ||
"test": "echo \"Error: no test specified\" && exit 1" | ||
"test": "node tests.js" | ||
}, | ||
@@ -15,0 +15,0 @@ "keywords": [ |
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
No tests
QualityPackage does not have any tests. This is a strong signal of a poorly maintained or low quality package.
Found 1 instance in 1 package
14003
10
66
0