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

Function assertIndexInRange

packages/core/src/util/assert.ts:130–136  ·  view source on GitHub ↗
(arr: any[], index: number)

Source from the content-addressed store, hash-verified

128}
129
130export function assertIndexInRange(arr: any[], index: number) {
131 assertDefined(arr, 'Array must be defined.');
132 const maxLen = arr.length;
133 if (index < 0 || index >= maxLen) {
134 throwError(`Index expected to be less than ${maxLen} but got ${index}`);
135 }
136}
137
138export function assertOneOf(value: any, ...validValues: any[]) {
139 if (validValues.indexOf(value) !== -1) return true;

Callers 15

assertTNodeCreationIndexFunction · 0.90
getBindingFunction · 0.90
getInjectorIndexFunction · 0.90
getByIndexMethod · 0.90
materializeViewResultsFunction · 0.90
loadQueryInternalFunction · 0.90
applyMutableOpCodesFunction · 0.90
applyIcuUpdateCaseFunction · 0.90
listenToDirectiveOutputFunction · 0.90
listenToOutputFunction · 0.90

Calls 2

assertDefinedFunction · 0.85
throwErrorFunction · 0.70

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…