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

Function keyValueArraySet

packages/core/src/util/array_utils.ts:196–210  ·  view source on GitHub ↗
(
  keyValueArray: KeyValueArray<V>,
  key: string,
  value: V,
)

Source from the content-addressed store, hash-verified

194 * @returns index (always even) of where the value vas set.
195 */
196export function keyValueArraySet<V>(
197 keyValueArray: KeyValueArray<V>,
198 key: string,
199 value: V,
200): number {
201 let index = keyValueArrayIndexOf(keyValueArray, key);
202 if (index >= 0) {
203 // if we found it set it.
204 keyValueArray[index | 1] = value;
205 } else {
206 index = ~index;
207 arrayInsert2(keyValueArray, index, key, value);
208 }
209 return index;
210}
211
212/**
213 * Retrieve a `value` for a `key` (on `undefined` if not found.)

Callers 6

classStringParserFunction · 0.90
collectStylingFromTAttrsFunction · 0.90
toStylingKeyValueArrayFunction · 0.90
styleKeyValueArraySetFunction · 0.90
classKeyValueArraySetFunction · 0.90

Calls 2

keyValueArrayIndexOfFunction · 0.85
arrayInsert2Function · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…