added Objectmap
This commit is contained in:
parent
95fe1f7937
commit
e3a811bffd
1
dist/index.d.ts
vendored
1
dist/index.d.ts
vendored
@ -1 +1,2 @@
|
|||||||
export * from "./lik.stringmap";
|
export * from "./lik.stringmap";
|
||||||
|
export * from "./lik.objectmap";
|
||||||
|
3
dist/index.js
vendored
3
dist/index.js
vendored
@ -4,4 +4,5 @@ function __export(m) {
|
|||||||
}
|
}
|
||||||
// import modules
|
// import modules
|
||||||
__export(require("./lik.stringmap"));
|
__export(require("./lik.stringmap"));
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBRUEsaUJBQWlCO0FBRWpCLGlCQUFjLGlCQUFpQixDQUFDLEVBQUEifQ==
|
__export(require("./lik.objectmap"));
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiaW5kZXguanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi90cy9pbmRleC50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7O0FBRUEsaUJBQWlCO0FBRWpCLGlCQUFjLGlCQUFpQixDQUFDLEVBQUE7QUFDaEMsaUJBQWMsaUJBQWlCLENBQUMsRUFBQSJ9
|
10
dist/lik.objectmap.d.ts
vendored
Normal file
10
dist/lik.objectmap.d.ts
vendored
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
/**
|
||||||
|
* allows keeping track of objects
|
||||||
|
*/
|
||||||
|
export declare class Objectmap {
|
||||||
|
private objectArray;
|
||||||
|
add(objectArg: any): void;
|
||||||
|
remove(objectArg: any): void;
|
||||||
|
checkForObject(objectArg: any): number;
|
||||||
|
wipe(): void;
|
||||||
|
}
|
33
dist/lik.objectmap.js
vendored
Normal file
33
dist/lik.objectmap.js
vendored
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
"use strict";
|
||||||
|
/**
|
||||||
|
* allows keeping track of objects
|
||||||
|
*/
|
||||||
|
class Objectmap {
|
||||||
|
constructor() {
|
||||||
|
this.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 = [];
|
||||||
|
}
|
||||||
|
}
|
||||||
|
exports.Objectmap = Objectmap;
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLm9iamVjdG1hcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2xpay5vYmplY3RtYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUVBOztHQUVHO0FBQ0g7SUFBQTtRQUNZLGdCQUFXLEdBQUcsRUFBRSxDQUFDO0lBbUI3QixDQUFDO0lBbEJHLEdBQUcsQ0FBQyxTQUFTO1FBQ1QsSUFBSSxDQUFDLFdBQVcsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUM7SUFDckMsQ0FBQzs7SUFDRCxNQUFNLENBQUMsU0FBUztRQUNaLElBQUksZUFBZSxHQUFHLEVBQUUsQ0FBQztRQUN6QixHQUFHLENBQUEsQ0FBQyxJQUFJLElBQUksSUFBSSxJQUFJLENBQUMsV0FBVyxDQUFDLENBQUEsQ0FBQztZQUM5QixFQUFFLENBQUEsQ0FBQyxJQUFJLEtBQUssU0FBUyxDQUFDLENBQUEsQ0FBQztnQkFDbkIsZUFBZSxDQUFDLElBQUksQ0FBQyxJQUFJLENBQUMsQ0FBQztZQUMvQixDQUFDO1FBQ0wsQ0FBQztRQUFBLENBQUM7UUFDRixJQUFJLENBQUMsV0FBVyxHQUFHLGVBQWUsQ0FBQztJQUN2QyxDQUFDOztJQUNELGNBQWMsQ0FBQyxTQUFTO1FBQ3BCLE1BQU0sQ0FBQyxJQUFJLENBQUMsV0FBVyxDQUFDLE9BQU8sQ0FBQyxTQUFTLEtBQUssQ0FBQyxDQUFDLENBQUMsQ0FBQTtJQUNyRCxDQUFDOztJQUNELElBQUk7UUFDQSxJQUFJLENBQUMsV0FBVyxHQUFHLEVBQUUsQ0FBQztJQUMxQixDQUFDO0FBQ0wsQ0FBQztBQXBCWSxpQkFBUyxZQW9CckIsQ0FBQSJ9
|
8
dist/lik.stringmap.js
vendored
8
dist/lik.stringmap.js
vendored
@ -19,7 +19,7 @@ class Stringmap {
|
|||||||
*/
|
*/
|
||||||
removeString(stringArg) {
|
removeString(stringArg) {
|
||||||
for (let keyArg in this._stringArray) {
|
for (let keyArg in this._stringArray) {
|
||||||
if (this._stringArray[keyArg] == stringArg) {
|
if (this._stringArray[keyArg] === stringArg) {
|
||||||
this._stringArray.splice(parseInt(keyArg), 1);
|
this._stringArray.splice(parseInt(keyArg), 1);
|
||||||
}
|
}
|
||||||
;
|
;
|
||||||
@ -59,7 +59,7 @@ class Stringmap {
|
|||||||
* checks if the Stringmap is empty
|
* checks if the Stringmap is empty
|
||||||
*/
|
*/
|
||||||
checkIsEmpty() {
|
checkIsEmpty() {
|
||||||
return (this._stringArray.length == 0);
|
return (this._stringArray.length === 0);
|
||||||
}
|
}
|
||||||
// trigger registering
|
// trigger registering
|
||||||
/**
|
/**
|
||||||
@ -78,7 +78,7 @@ class Stringmap {
|
|||||||
registerUntilTrue(functionArg, doFunctionArg) {
|
registerUntilTrue(functionArg, doFunctionArg) {
|
||||||
this._triggerUntilTrueFunctionArray.push(() => {
|
this._triggerUntilTrueFunctionArray.push(() => {
|
||||||
let result = functionArg();
|
let result = functionArg();
|
||||||
if (result == true) {
|
if (result === true) {
|
||||||
doFunctionArg();
|
doFunctionArg();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
@ -87,4 +87,4 @@ class Stringmap {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
exports.Stringmap = Stringmap;
|
exports.Stringmap = Stringmap;
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLnN0cmluZ21hcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2xpay5zdHJpbmdtYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLE1BQVksT0FBTyxXQUFNLGVBQWUsQ0FBQyxDQUFBO0FBVXpDO0lBR0k7UUFGUSxpQkFBWSxHQUFZLEVBQUUsQ0FBQztRQUMzQixtQ0FBOEIsR0FBcUIsRUFBRSxDQUFDO0lBRzlELENBQUM7O0lBQ0Q7O09BRUc7SUFDSCxTQUFTLENBQUMsU0FBZ0I7UUFDdEIsSUFBSSxDQUFDLFlBQVksQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUM7UUFDbEMsSUFBSSxDQUFDLGFBQWEsRUFBRSxDQUFDO0lBQ3pCLENBQUM7O0lBRUQ7O09BRUc7SUFDSCxZQUFZLENBQUMsU0FBZ0I7UUFDekIsR0FBRyxDQUFDLENBQUMsSUFBSSxNQUFNLElBQUksSUFBSSxDQUFDLFlBQVksQ0FBQyxDQUFBLENBQUM7WUFDbEMsRUFBRSxDQUFBLENBQUMsSUFBSSxDQUFDLFlBQVksQ0FBQyxNQUFNLENBQUMsSUFBSSxTQUFTLENBQUMsQ0FBQSxDQUFDO2dCQUN2QyxJQUFJLENBQUMs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QSJ9
|
28
test/test.js
28
test/test.js
@ -37,5 +37,31 @@ describe("lik", function () {
|
|||||||
testStringmap.wipe();
|
testStringmap.wipe();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
describe("Objectmap", function () {
|
||||||
|
let testObjectmap;
|
||||||
|
let testObject1 = {
|
||||||
|
propOne: "hello",
|
||||||
|
propTwo: "hello2"
|
||||||
|
};
|
||||||
|
let testObject2 = {
|
||||||
|
propOne: "hello",
|
||||||
|
propTwo: "hello2"
|
||||||
|
};
|
||||||
|
it("should correctly instantiate an Objectmap", function () {
|
||||||
|
testObjectmap = new lik.Objectmap();
|
||||||
|
testObjectmap.should.be.instanceof(lik.Objectmap);
|
||||||
});
|
});
|
||||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbInRlc3QudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLFFBQU8sY0FBYyxDQUFDLENBQUE7QUFDdEIsTUFBTyxHQUFHLFdBQVcsZUFBZSxDQUFDLENBQUM7QUFDdEMsUUFBTyxRQUFRLENBQUMsQ0FBQTtBQUVoQixRQUFRLENBQUMsS0FBSyxFQUFDO0lBQ1gsUUFBUSxDQUFDLFdBQVcsRUFBQztRQUNqQixJQUFJLGFBQTJCLENBQUM7UUFDaEMsSUFBSSxXQUFXLEdBQUcsYUFBYSxDQUFDO1FBQ2hDLElBQUksV0FBVyxHQUFHLGFBQWEsQ0FBQztRQUNoQyxJQUFJLFdBQVcsR0FBRyxhQUFhLENBQUM7UUFDaEMsRUFBRSxDQUFDLHdDQUF3QyxFQUFDO1lBQ3hDLGFBQWEsR0FBRyxJQUFJLEdBQUcsQ0FBQyxTQUFTLEVBQUUsQ0FBQztZQUNwQyxhQUFhLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxVQUFVLENBQUMsR0FBRyxDQUFDLFNBQVMsQ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UMsQ0FBQztRQUNILEVBQUUsQ0FBQyx1Q0FBdUMsRUFBQztZQUN2QyxhQUFhLENBQUMsWUFBWSxDQUFDLFdBQVcsQ0FBQyxDQUFDO1lBQ3hDLGFBQWEsQ0FBQyxXQUFXLENBQUMsV0FBVyxDQUFDLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxLQUFLLEVBQUUsQ0FBQztRQUM3RCxDQUFDLENBQUMsQ0FBQztRQUNILEVBQUUsQ0FBQyxrREFBa0QsRUFBQztZQUNsRCxhQUFhLENBQUMsaUJBQWlCLENBQzNCLFFBQU8sTUFBTSxDQUFDLGFBQWEsQ0FBQyxZQUFZLEVBQUUsQ0FBQSxDQUFBLENBQUMsRUFDM0MsUUFBTyxPQUFPLENBQUMsR0FBRyxDQUFDLHdCQUF3QixDQUFDLENBQUEsQ0FBQSxDQUFDLENBQ2hELENBQUM7UUFDTixDQUFDLENBQUMsQ0FBQztRQUNILEVBQUUsQ0FBQyxvQ0FBb0MsRUFBQztZQUNwQyxhQUFhLENBQUMsSUFBSSxFQUFFLENBQUM7UUFDekIsQ0FBQyxDQUFDLENBQUE7SUFDTixDQUFDLENBQUMsQ0FBQTtBQUNOLENBQUMsQ0FBQyxDQUFDIn0=
|
it("should correctly add an object to Objectmap", function () {
|
||||||
|
testObjectmap.add(testObject1);
|
||||||
|
testObjectmap.checkForObject(testObject1).should.be.true;
|
||||||
|
testObjectmap.checkForObject(testObject2).should.be.false;
|
||||||
|
});
|
||||||
|
it("should correctly remove an object to Objectmap", function () {
|
||||||
|
testObjectmap.add(testObject2);
|
||||||
|
testObjectmap.remove(testObject1);
|
||||||
|
testObjectmap.checkForObject(testObject1).should.be.false;
|
||||||
|
testObjectmap.checkForObject(testObject2).should.be.true;
|
||||||
|
});
|
||||||
|
});
|
||||||
|
});
|
||||||
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidGVzdC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb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IsYUFBYSxDQUFDLE1BQU0sQ0FBQyxXQUFXLENBQUMsQ0FBQztZQUNsQyxhQUFhLENBQUMsY0FBYyxDQUFDLFdBQVcsQ0FBQyxDQUFDLE1BQU0sQ0FBQyxFQUFFLENBQUMsS0FBSyxDQUFDO1lBQzFELGFBQWEsQ0FBQyxjQUFjLENBQUMsV0FBVyxDQUFDLENBQUMsTUFBTSxDQUFDLEVBQUUsQ0FBQyxJQUFJLENBQUM7UUFDN0QsQ0FBQyxDQUFDLENBQUM7SUFDUCxDQUFDLENBQUMsQ0FBQTtBQUNOLENBQUMsQ0FBQyxDQUFDIn0=
|
30
test/test.ts
30
test/test.ts
@ -39,5 +39,35 @@ describe("lik",function(){
|
|||||||
it("should remove wipe and then notify",function(){
|
it("should remove wipe and then notify",function(){
|
||||||
testStringmap.wipe();
|
testStringmap.wipe();
|
||||||
})
|
})
|
||||||
|
});
|
||||||
|
describe("Objectmap",function(){
|
||||||
|
interface ITestObject {
|
||||||
|
propOne:string;
|
||||||
|
propTwo:string;
|
||||||
|
}
|
||||||
|
let testObjectmap:lik.Objectmap;
|
||||||
|
let testObject1:ITestObject = {
|
||||||
|
propOne: "hello",
|
||||||
|
propTwo: "hello2"
|
||||||
|
};
|
||||||
|
let testObject2:ITestObject = {
|
||||||
|
propOne: "hello",
|
||||||
|
propTwo: "hello2"
|
||||||
|
};
|
||||||
|
it("should correctly instantiate an Objectmap",function(){
|
||||||
|
testObjectmap = new lik.Objectmap();
|
||||||
|
testObjectmap.should.be.instanceof(lik.Objectmap);
|
||||||
|
});
|
||||||
|
it("should correctly add an object to Objectmap",function(){
|
||||||
|
testObjectmap.add(testObject1);
|
||||||
|
testObjectmap.checkForObject(testObject1).should.be.true;
|
||||||
|
testObjectmap.checkForObject(testObject2).should.be.false;
|
||||||
|
});
|
||||||
|
it("should correctly remove an object to Objectmap",function(){
|
||||||
|
testObjectmap.add(testObject2);
|
||||||
|
testObjectmap.remove(testObject1);
|
||||||
|
testObjectmap.checkForObject(testObject1).should.be.false;
|
||||||
|
testObjectmap.checkForObject(testObject2).should.be.true;
|
||||||
|
});
|
||||||
})
|
})
|
||||||
});
|
});
|
@ -3,3 +3,4 @@ import * as plugins from "./lik.plugins";
|
|||||||
// import modules
|
// 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){
|
removeString(stringArg:string){
|
||||||
for (let keyArg in this._stringArray){
|
for (let keyArg in this._stringArray){
|
||||||
if(this._stringArray[keyArg] == stringArg){
|
if(this._stringArray[keyArg] === stringArg){
|
||||||
this._stringArray.splice(parseInt(keyArg),1);
|
this._stringArray.splice(parseInt(keyArg),1);
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
@ -66,7 +66,7 @@ export class Stringmap {
|
|||||||
* checks if the Stringmap is empty
|
* checks if the Stringmap is empty
|
||||||
*/
|
*/
|
||||||
checkIsEmpty(){
|
checkIsEmpty(){
|
||||||
return (this._stringArray.length == 0);
|
return (this._stringArray.length === 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
// trigger registering
|
// trigger registering
|
||||||
@ -88,7 +88,7 @@ export class Stringmap {
|
|||||||
this._triggerUntilTrueFunctionArray.push(
|
this._triggerUntilTrueFunctionArray.push(
|
||||||
() => {
|
() => {
|
||||||
let result = functionArg();
|
let result = functionArg();
|
||||||
if(result == true){
|
if(result === true){
|
||||||
doFunctionArg();
|
doFunctionArg();
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
Loading…
Reference in New Issue
Block a user