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

Method init

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

Source from the content-addressed store, hash-verified

305 }
306
307 private init() {
308 if (this.map === null) {
309 this.map = new Map<string, string[]>();
310 }
311 if (this.cloneFrom !== null) {
312 this.cloneFrom.init();
313
314 for (const [key, values] of this.cloneFrom.map!.entries()) {
315 this.map!.set(key, values);
316 }
317
318 this.updates!.forEach((update) => {
319 switch (update.op) {
320 case 'a':
321 case 's':
322 const base = update.op === 'a' ? (this.map!.get(update.param) || []).slice() : [];
323 base.push(valueToString(update.value!));
324 this.map!.set(update.param, base);
325 break;
326 case 'd':
327 if (update.value !== undefined) {
328 const base = (this.map!.get(update.param) || []).slice();
329 const idx = base.indexOf(valueToString(update.value));
330 if (idx !== -1) {
331 base.splice(idx, 1);
332 }
333 if (base.length > 0) {
334 this.map!.set(update.param, base);
335 } else {
336 this.map!.delete(update.param);
337 }
338 } else {
339 this.map!.delete(update.param);
340 break;
341 }
342 }
343 });
344 this.cloneFrom = this.updates = null;
345 }
346 }
347}

Callers 5

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

Calls 10

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

Tested by

no test coverage detected