MCPcopy
hub / github.com/angular/angular / parse

Method parse

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

Source from the content-addressed store, hash-verified

768describe('createUrlTree with custom serializer', () => {
769 class CustomUrlSerializer extends DefaultUrlSerializer {
770 override parse(url: string): UrlTree {
771 const tree = super.parse(url);
772 const qp: {[key: string]: any} = {};
773 Object.keys(tree.queryParams).forEach((key) => {
774 const value = tree.queryParams[key];
775 if (typeof value === 'string' && (value.startsWith('{') || value.startsWith('['))) {
776 try {
777 qp[key] = JSON.parse(value);
778 } catch {}
779 } else {
780 qp[key] = value;
781 }
782 });
783 tree.queryParams = qp;
784 return tree;
785 }
786 override serialize(tree: UrlTree): string {
787 const qp: {[key: string]: any} = {};
788 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