MCPcopy Create free account
hub / github.com/activejs/activejs / push

Method push

packages/core/src/lib/list-unit.ts:430–444  ·  view source on GitHub ↗

* Appends new items to the list-value. \ * Dispatches a new copy of the value, without mutating the current-value. * * It only works if the Unit is not frozen, and at least 1 item is provided. * * @param items The items to be appended to the list. * @returns The new length

(...items: Item[])

Source from the content-addressed store, hash-verified

428 * @category Customised Array.prototype
429 */
430 push(...items: Item[]): number {
431 if (this.isFrozen || !items.length) {
432 return this.length;
433 }
434 this.checkSerializabilityMaybe(items);
435
436 const listShallowCopy = [...this.rawValue()];
437 const newLength = listShallowCopy.push(...this.deepCopyMaybe(items));
438 this.updateValueAndCache(listShallowCopy);
439
440 if (this.eventsSubject?.observers.length && !this.isMuted) {
441 this.eventsSubject.next(new EventListUnitPush(items));
442 }
443 return newLength;
444 }
445
446 /**
447 * Removes the last item from the list-{@link value} and returns it. \

Callers 15

sanitizeIndicesFunction · 0.80
updateCacheFunction · 0.80
removeMethod · 0.80
removeIfMethod · 0.80
deleteMethod · 0.80
deleteIfMethod · 0.80
findByPropMethod · 0.80
utils.tsFile · 0.80
randomMutationFunction · 0.80
deepObjectExtractFunction · 0.80
list-unit.spec.tsFile · 0.80
selection.spec.tsFile · 0.80

Calls 1

nextMethod · 0.45

Tested by

no test coverage detected