MCPcopy Index your code
hub / github.com/ionic-team/ionic-framework / configFromURL

Function configFromURL

core/src/global/config.ts:57–77  ·  view source on GitHub ↗
(win: Window)

Source from the content-addressed store, hash-verified

55};
56
57export const configFromURL = (win: Window) => {
58 const configObj: any = {};
59 win.location.search
60 .slice(1)
61 .split('&')
62 .map((entry) => entry.split('='))
63 .map(([key, value]) => {
64 try {
65 return [decodeURIComponent(key), decodeURIComponent(value)];
66 } catch (e) {
67 return ['', ''];
68 }
69 })
70 .filter(([key]) => startsWith(key, IONIC_PREFIX))
71 .map(([key, value]) => [key.slice(IONIC_PREFIX.length), value])
72 .forEach(([key, value]) => {
73 configObj[key] = value;
74 });
75
76 return configObj;
77};
78
79const startsWith = (input: string, search: string): boolean => {
80 return input.substr(0, search.length) === search;

Callers 2

initializeFunction · 0.90

Calls 1

startsWithFunction · 0.70

Tested by

no test coverage detected