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

Method parse

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

Source from the content-addressed store, hash-verified

826describe('createUrlTree with custom serializer', () => {
827 class CustomUrlSerializer extends DefaultUrlSerializer {
828 override parse(url: string): UrlTree {
829 const tree = super.parse(url);
830 const qp: {[key: string]: any} = {};
831 Object.keys(tree.queryParams).forEach((key) => {
832 const value = tree.queryParams[key];
833 if (typeof value === 'string' && (value.startsWith('{') || value.startsWith('['))) {
834 try {
835 qp[key] = JSON.parse(value);
836 } catch {}
837 } else {
838 qp[key] = value;
839 }
840 });
841 tree.queryParams = qp;
842 return tree;
843 }
844 override serialize(tree: UrlTree): string {
845 const qp: {[key: string]: any} = {};
846 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