add list contains.

This commit is contained in:
Rintim 2023-09-21 20:09:32 +08:00
parent 47f086fb45
commit 8bf10e67d3
1 changed files with 12 additions and 0 deletions

View File

@ -24823,6 +24823,18 @@
if(storage===value) return true; if(storage===value) return true;
return !Array.isArray(storage) || storage.contains(value); return !Array.isArray(storage) || storage.contains(value);
}, },
hasStorageAny:function(name,values){
const storage=this.storage[name];
if(!storage) return false;
if (!Array.isArray(storage)) return values.contains(storage);
return values.some(item => storage.contains(item));
},
hasStorageAll:function(name,values){
const storage=this.storage[name];
if(!storage) return false;
if (!Array.isArray(storage)) return false;
return values.every(item => storage.contains(item));
},
initStorage:function(name,value){ initStorage:function(name,value){
return this.hasStorage(name)?this.getStorage(name):this.setStorage(name,value); return this.hasStorage(name)?this.getStorage(name):this.setStorage(name,value);
}, },