MCPcopy Create free account
hub / github.com/angular/angular / init

Method init

packages/common/http/src/params.ts:321–360  ·  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
328 for (const [key, values] of this.cloneFrom.map!.entries()) {
329 this.map!.set(key, values);
330 }
331
332 this.updates!.forEach((update) => {
333 switch (update.op) {
334 case 'a':
335 case 's':
336 const base = update.op === 'a' ? (this.map!.get(update.param) || []).slice() : [];
337 base.push(valueToString(update.value!));
338 this.map!.set(update.param, base);
339 break;
340 case 'd':
341 if (update.value !== undefined) {
342 const base = (this.map!.get(update.param) || []).slice();
343 const idx = base.indexOf(valueToString(update.value));
344 if (idx !== -1) {
345 base.splice(idx, 1);
346 }
347 if (base.length > 0) {
348 this.map!.set(update.param, base);
349 } else {
350 this.map!.delete(update.param);
351 }
352 } else {
353 this.map!.delete(update.param);
354 break;
355 }
356 }
357 });
358 this.cloneFrom = this.updates = null;
359 }
360 }
361}

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
setMethod · 0.65
getMethod · 0.65
entriesMethod · 0.45
forEachMethod · 0.45
pushMethod · 0.45
deleteMethod · 0.45

Tested by

no test coverage detected