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

Function normalizeQueryParams

packages/router/src/create_url_tree.ts:172–180  ·  view source on GitHub ↗

* Normalizes a query parameter value by using the `UrlSerializer` to serialize then parse the value. * * This ensures that the value is consistent between parsing a URL in the browser on a fresh page load (or page refresh) * and a navigation where the query parameter value is passed directly to t

(k: string, v: unknown, urlSerializer: UrlSerializer)

Source from the content-addressed store, hash-verified

170 * over how a browser URL is parsed into a `UrlTree` on initial load/page refresh.
171 */
172function normalizeQueryParams(k: string, v: unknown, urlSerializer: UrlSerializer): unknown {
173 // Hack for empty string query param, which, for whatever reason, happens
174 // in a test. Parsing drops empty key params (which might not really be necessary).
175 // It's probably really a test issue but I don't have the time to fix it...
176 k ||= 'ɵ';
177 const tree = new UrlTree();
178 tree.queryParams = {[k]: v};
179 return urlSerializer.parse(urlSerializer.serialize(tree)).queryParams[k];
180}
181
182function tree(
183 oldRoot: UrlSegmentGroup,

Callers 1

treeFunction · 0.70

Calls 2

parseMethod · 0.65
serializeMethod · 0.65

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…