added Objectmap
This commit is contained in:
@ -2,4 +2,5 @@ import * as plugins from "./lik.plugins";
|
||||
|
||||
// import modules
|
||||
|
||||
export * from "./lik.stringmap";
|
||||
export * from "./lik.stringmap";
|
||||
export * from "./lik.objectmap";
|
26
ts/lik.objectmap.ts
Normal file
26
ts/lik.objectmap.ts
Normal file
@ -0,0 +1,26 @@
|
||||
import * as plugins from "./lik.plugins";
|
||||
|
||||
/**
|
||||
* allows keeping track of objects
|
||||
*/
|
||||
export class Objectmap {
|
||||
private objectArray = [];
|
||||
add(objectArg){
|
||||
this.objectArray.push(objectArg);
|
||||
};
|
||||
remove(objectArg){
|
||||
let replacmentArray = [];
|
||||
for(let item of this.objectArray){
|
||||
if(item !== objectArg){
|
||||
replacmentArray.push(item);
|
||||
}
|
||||
};
|
||||
this.objectArray = replacmentArray;
|
||||
};
|
||||
checkForObject(objectArg){
|
||||
return this.objectArray.indexOf(objectArg !== -1)
|
||||
};
|
||||
wipe(){
|
||||
this.objectArray = [];
|
||||
}
|
||||
}
|
@ -27,7 +27,7 @@ export class Stringmap {
|
||||
*/
|
||||
removeString(stringArg:string){
|
||||
for (let keyArg in this._stringArray){
|
||||
if(this._stringArray[keyArg] == stringArg){
|
||||
if(this._stringArray[keyArg] === stringArg){
|
||||
this._stringArray.splice(parseInt(keyArg),1);
|
||||
};
|
||||
};
|
||||
@ -66,7 +66,7 @@ export class Stringmap {
|
||||
* checks if the Stringmap is empty
|
||||
*/
|
||||
checkIsEmpty(){
|
||||
return (this._stringArray.length == 0);
|
||||
return (this._stringArray.length === 0);
|
||||
}
|
||||
|
||||
// trigger registering
|
||||
@ -88,7 +88,7 @@ export class Stringmap {
|
||||
this._triggerUntilTrueFunctionArray.push(
|
||||
() => {
|
||||
let result = functionArg();
|
||||
if(result == true){
|
||||
if(result === true){
|
||||
doFunctionArg();
|
||||
}
|
||||
return result;
|
||||
|
Reference in New Issue
Block a user