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

Function arrayInsert

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

Source from the content-addressed store, hash-verified

107 * @param value Value to add to array.
108 */
109export function arrayInsert(array: any[], index: number, value: any): void {
110 ngDevMode && assertLessThanOrEqual(index, array.length, "Can't insert past array end.");
111 let end = array.length;
112 while (end > index) {
113 const previousEnd = end - 1;
114 array[end] = array[previousEnd];
115 end = previousEnd;
116 }
117 array[index] = value;
118}
119
120/**
121 * Same as `Array.splice2(index, 0, value1, value2)` but faster.

Callers 1

expectArrayInsertFunction · 0.90

Calls 1

assertLessThanOrEqualFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…