add list contains.
This commit is contained in:
parent
47f086fb45
commit
8bf10e67d3
12
game/game.js
12
game/game.js
|
@ -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);
|
||||||
},
|
},
|
||||||
|
|
Loading…
Reference in New Issue