add lik.Objectmap.isEmpty()
This commit is contained in:
@ -56,6 +56,17 @@ export class Objectmap<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
|
||||
*/
|
||||
|
Reference in New Issue
Block a user