Added all and any to arrays

Removed notes
This commit is contained in:
Ray committed 2024-08-26 12:59:53 +01:00
1 parent ba85af796e
commit e3ad9348b5
3 files changed
+34 -4

No files matched your search

-2
View File
@@ -1,2 +0,0 @@
npm install --save-dev webpack webpack-cli
npm run build
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "LiteRyzJS",
"version": "0.1.0.301",
"version": "0.1.0.357",
"devDependencies": {
"css-loader": "^7.1.2",
"sass": "^1.77.8",
+33 -1
View File
@@ -36,8 +36,40 @@ Array.prototype.addRange = function (array) {
return this;
};
Array.prototype.all = function (propName, value) {
for (let i = 0; i < this.length; i++) {
if (propName == null) {
if (this[i] != value){
return false;
}
} else {
if (typeof(this[i][propName]) != "undefined") {
if (this[i][propName] != value){
return false;
}
}
}
}
return true;
};
Array.prototype.any = function (propName, value) {
return (this.count(propName, value) > 0);
for (let i = 0; i < this.length; i++) {
if (propName == null) {
if (this[i] == value){
return true;
}
} else {
if (typeof(this[i][propName]) != "undefined") {
if (this[i][propName] == value){
return true;
}
}
}
}
return false;
};
Array.prototype.copy = function () {