Avoid Function#apply() for performance.
This commit is contained in:
parent
6c83308451
commit
5e0c4d7b7a
@ -128,7 +128,7 @@ export default class Collection extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
add (keyOrObjectWithId, valueIfKey = null) {
|
add (keyOrObjectWithId, valueIfKey = null) {
|
||||||
const [key, value] = this._resolveEntry.apply(this, arguments)
|
const [key, value] = this._resolveEntry(keyOrObjectWithId, valueIfKey)
|
||||||
this._assertHasNot(key)
|
this._assertHasNot(key)
|
||||||
|
|
||||||
this._map[key] = value
|
this._map[key] = value
|
||||||
@ -139,7 +139,7 @@ export default class Collection extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
set (keyOrObjectWithId, valueIfKey = null) {
|
set (keyOrObjectWithId, valueIfKey = null) {
|
||||||
const [key, value] = this._resolveEntry.apply(this, arguments)
|
const [key, value] = this._resolveEntry(keyOrObjectWithId, valueIfKey)
|
||||||
|
|
||||||
const action = this.has(key) ? 'update' : 'add'
|
const action = this.has(key) ? 'update' : 'add'
|
||||||
this._map[key] = value
|
this._map[key] = value
|
||||||
@ -165,7 +165,7 @@ export default class Collection extends EventEmitter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
update (keyOrObjectWithId, valueIfKey = null) {
|
update (keyOrObjectWithId, valueIfKey = null) {
|
||||||
const [key, value] = this._resolveEntry.apply(this, arguments)
|
const [key, value] = this._resolveEntry(keyOrObjectWithId, valueIfKey)
|
||||||
this._assertHas(key)
|
this._assertHas(key)
|
||||||
|
|
||||||
this._map[key] = value
|
this._map[key] = value
|
||||||
|
Loading…
Reference in New Issue
Block a user