Added all and any to arrays

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

View File

@ -1,2 +0,0 @@
npm install --save-dev webpack webpack-cli
npm run build

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",

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 () {