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

Method init

packages/common/http/src/params.ts:321–356  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

319 }
320
321 private init() {
322 if (this.map === null) {
323 this.map = new Map<string, string[]>();
324 }
325 if (this.cloneFrom !== null) {
326 this.cloneFrom.init();
327 this.cloneFrom.keys().forEach((key) => this.map!.set(key, this.cloneFrom!.map!.get(key)!));
328 this.updates!.forEach((update) => {
329 switch (update.op) {
330 case 'a':
331 case 's':
332 const base = (update.op === 'a' ? this.map!.get(update.param) : undefined) || [];
333 base.push(valueToString(update.value!));
334 this.map!.set(update.param, base);
335 break;
336 case 'd':
337 if (update.value !== undefined) {
338 let base = this.map!.get(update.param) || [];
339 const idx = base.indexOf(valueToString(update.value));
340 if (idx !== -1) {
341 base.splice(idx, 1);
342 }
343 if (base.length > 0) {
344 this.map!.set(update.param, base);
345 } else {
346 this.map!.delete(update.param);
347 }
348 } else {
349 this.map!.delete(update.param);
350 break;
351 }
352 }
353 });
354 this.cloneFrom = this.updates = null;
355 }
356 }
357}

Callers 5

hasMethod · 0.95
getMethod · 0.95
getAllMethod · 0.95
keysMethod · 0.95
toStringMethod · 0.95

Calls 9

valueToStringFunction · 0.85
indexOfMethod · 0.80
initMethod · 0.65
keysMethod · 0.65
setMethod · 0.65
getMethod · 0.65
forEachMethod · 0.45
pushMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected