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

Method parse

packages/router/test/create_url_tree.spec.ts:868–883  ·  view source on GitHub ↗
(url: string)

Source from the content-addressed store, hash-verified

866describe('createUrlTree with custom serializer', () => {
867 class CustomUrlSerializer extends DefaultUrlSerializer {
868 override parse(url: string): UrlTree {
869 const tree = super.parse(url);
870 const qp: {[key: string]: any} = {};
871 Object.keys(tree.queryParams).forEach((key) => {
872 const value = tree.queryParams[key];
873 if (typeof value === 'string' && (value.startsWith('{') || value.startsWith('['))) {
874 try {
875 qp[key] = JSON.parse(value);
876 } catch {}
877 } else {
878 qp[key] = value;
879 }
880 });
881 tree.queryParams = qp;
882 return tree;
883 }
884 override serialize(tree: UrlTree): string {
885 const qp: {[key: string]: any} = {};
886 Object.keys(tree.queryParams).forEach((key) => {

Callers

nothing calls this directly

Calls 3

parseMethod · 0.65
keysMethod · 0.65
forEachMethod · 0.45

Tested by

no test coverage detected