add lik.Objectmap.isEmpty()
This commit is contained in:
parent
bb3b02ed74
commit
cfbc47e365
12
dist/lik.objectmap.d.ts
vendored
12
dist/lik.objectmap.d.ts
vendored
@ -29,6 +29,10 @@ export declare class Objectmap<T> {
|
||||
* find object
|
||||
*/
|
||||
find(findFunction: IObjectmapFindFunction<T>): T;
|
||||
/**
|
||||
* finds a specific element and then removes it
|
||||
*/
|
||||
findOneAndRemove(findFunction: any): T;
|
||||
/**
|
||||
* run function for each item in Objectmap
|
||||
*/
|
||||
@ -37,14 +41,14 @@ export declare class Objectmap<T> {
|
||||
* gets an object in the Observablemap and removes it, so it can't be retrieved again
|
||||
*/
|
||||
getOneAndRemove(): T;
|
||||
/**
|
||||
* finds a specific element and then removes it
|
||||
*/
|
||||
findOneAndRemove(findFunction: any): T;
|
||||
/**
|
||||
* returns a cloned array of all the objects currently in the Objectmap
|
||||
*/
|
||||
getArray(): T[];
|
||||
/**
|
||||
* check if Objectmap ist empty
|
||||
*/
|
||||
isEmpty(): boolean;
|
||||
/**
|
||||
* remove object from Objectmap
|
||||
*/
|
||||
|
33
dist/lik.objectmap.js
vendored
33
dist/lik.objectmap.js
vendored
@ -42,6 +42,16 @@ class Objectmap {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* finds a specific element and then removes it
|
||||
*/
|
||||
findOneAndRemove(findFunction) {
|
||||
let foundElement = this.find(findFunction);
|
||||
if (foundElement) {
|
||||
this.remove(foundElement);
|
||||
}
|
||||
return foundElement;
|
||||
}
|
||||
/**
|
||||
* run function for each item in Objectmap
|
||||
*/
|
||||
@ -54,22 +64,23 @@ class Objectmap {
|
||||
getOneAndRemove() {
|
||||
return this.objectArray.shift();
|
||||
}
|
||||
/**
|
||||
* finds a specific element and then removes it
|
||||
*/
|
||||
findOneAndRemove(findFunction) {
|
||||
let foundElement = this.find(findFunction);
|
||||
if (foundElement) {
|
||||
this.remove(foundElement);
|
||||
}
|
||||
return foundElement;
|
||||
}
|
||||
/**
|
||||
* returns a cloned array of all the objects currently in the Objectmap
|
||||
*/
|
||||
getArray() {
|
||||
return plugins.lodash.cloneDeep(this.objectArray);
|
||||
}
|
||||
/**
|
||||
* check if Objectmap ist empty
|
||||
*/
|
||||
isEmpty() {
|
||||
if (this.objectArray.length === 0) {
|
||||
return true;
|
||||
}
|
||||
else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
/**
|
||||
* remove object from Objectmap
|
||||
*/
|
||||
@ -90,4 +101,4 @@ class Objectmap {
|
||||
}
|
||||
}
|
||||
exports.Objectmap = Objectmap;
|
||||
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoibGlrLm9iamVjdG1hcC5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uL3RzL2xpay5vYmplY3RtYXAudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IjtBQUFBLHlDQUF3QztBQVV4Qzs7R0FFRztBQUNIO0lBR0k7O09BRUc7SUFDSDtRQUxRLGdCQUFXLEdBQVEsRUFBRSxDQUFBO0lBTzdCLENBQUM7SUFFRDs7T0FFRztJQUNILEdBQUcsQ0FBQyxTQUFZO1FBQ1osSUFBSSxDQUFDLFdBQVcsQ0FBQyxJQUFJLENBQUMsU0FBUyxDQUFDLENBQUE7SUFDcEMsQ0FBQztJQUVEOztPQUVHO0lBQ0gsUUFBUSxDQUFDLGNBQW1CO1FBQ3hCLEdBQUcsQ0FBQyxDQUFDLElBQUksSUFBSSxJQUFJLGNBQWMsQ0FBQyxDQUFDLENBQUM7WUFDOUIsSUFBSSxDQUFDLEdBQUcsQ0FBQyxJQUFJLENBQUMsQ0FBQTtRQUNsQixDQUFDO0lBQ0wsQ0FBQztJQUVEOztPQUVHO0lBQ0gsY0FBYyxDQUFDLFNBQVk7UUFDdkIsTUFBTSxDQUFDLElBQUksQ0FBQyxXQUFXLENBQUMsT0FBTyxDQUFDLFNBQVMsQ0FBQyxLQUFLLENBQUMsQ0FBQyxD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T> {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* finds a specific element and then removes it
|
||||
*/
|
||||
findOneAndRemove(findFunction): T {
|
||||
let foundElement = this.find(findFunction)
|
||||
if (foundElement) {
|
||||
this.remove(foundElement)
|
||||
}
|
||||
return foundElement
|
||||
}
|
||||
|
||||
/**
|
||||
* run function for each item in Objectmap
|
||||
*/
|
||||
@ -70,17 +81,6 @@ export class Objectmap<T> {
|
||||
return this.objectArray.shift()
|
||||
}
|
||||
|
||||
/**
|
||||
* finds a specific element and then removes it
|
||||
*/
|
||||
findOneAndRemove(findFunction): T {
|
||||
let foundElement = this.find(findFunction)
|
||||
if (foundElement) {
|
||||
this.remove(foundElement)
|
||||
}
|
||||
return foundElement
|
||||
}
|
||||
|
||||
/**
|
||||
* returns a cloned array of all the objects currently in the Objectmap
|
||||
*/
|
||||
@ -88,6 +88,17 @@ export class Objectmap<T> {
|
||||
return plugins.lodash.cloneDeep(this.objectArray)
|
||||
}
|
||||
|
||||
/**
|
||||
* check if Objectmap ist empty
|
||||
*/
|
||||
isEmpty(): boolean {
|
||||
if (this.objectArray.length === 0) {
|
||||
return true
|
||||
} else {
|
||||
return false
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* remove object from Objectmap
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user