33 lines
1.7 KiB
JavaScript
33 lines
1.7 KiB
JavaScript
|
"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,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLm9iamVjdG1hcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2xpay5vYmplY3RtYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUVBOztHQUVHO0FBQ0g7SUFBQTtRQUNZLGdCQUFXLEdBQUcsRUFBRSxDQUFDO0lBbUI3QixDQUFDO0lBbEJHLEdBQUcsQ0FBQyxTQUFTO1FBQ1QsSUFBSSxDQUFDLFdBQVcsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUM7SUFDckMsQ0FBQzs7SUFDRCxNQUFNLENBQUMsU0FBUztRQUNaLElBQUksZUFBZSxHQUFHLEVBQUUsQ0FBQztRQUN6QixHQUFHLENBQUEsQ0FBQyxJQUFJLElBQUksSUFBSSxJQUFJLENBQUMsV0FBVyxDQUFDLENBQUEsQ0FBQztZQUM5QixFQUFFLENBQUEsQ0FBQyxJQUFJLEtBQUssU0FBUyxDQUFDL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