MCPcopy
hub / github.com/angular/angular / ParamsAsMap

Class ParamsAsMap

packages/router/src/shared.ts:75–107  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

73}
74
75class ParamsAsMap implements ParamMap {
76 private params: Params;
77
78 constructor(params: Params) {
79 this.params = params || {};
80 }
81
82 has(name: string): boolean {
83 return Object.prototype.hasOwnProperty.call(this.params, name);
84 }
85
86 get(name: string): string | null {
87 if (this.has(name)) {
88 const v = this.params[name];
89 return Array.isArray(v) ? v[0] : v;
90 }
91
92 return null;
93 }
94
95 getAll(name: string): string[] {
96 if (this.has(name)) {
97 const v = this.params[name];
98 return Array.isArray(v) ? v : [v];
99 }
100
101 return [];
102 }
103
104 get keys(): string[] {
105 return Object.keys(this.params);
106 }
107}
108
109/**
110 * Converts a `Params` instance to a `ParamMap`.

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…