MCPcopy Index your code
hub / github.com/angular/angular / addToArray

Function addToArray

packages/core/src/util/array_utils.ts:46–53  ·  view source on GitHub ↗
(arr: any[], index: number, value: any)

Source from the content-addressed store, hash-verified

44}
45
46export function addToArray(arr: any[], index: number, value: any): void {
47 // perf: array.push is faster than array.splice!
48 if (index >= arr.length) {
49 arr.push(value);
50 } else {
51 arr.splice(index, 0, value);
52 }
53}
54
55export function removeFromArray(arr: any[], index: number): any {
56 // perf: array.pop is faster than array.splice!

Callers 2

insertImplMethod · 0.90
insertViewFunction · 0.90

Calls 1

pushMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…