msw
Version:
1 lines • 870 B
Source Map (JSON)
{"version":3,"sources":["../../../../src/core/utils/url/cleanUrl.ts"],"sourcesContent":["const REDUNDANT_CHARACTERS_EXP = /[\\?|#].*$/g\n\nexport function getSearchParams(path: string) {\n return new URL(`/${path}`, 'http://localhost').searchParams\n}\n\n/**\n * Removes search parameters and the fragment\n * from a given URL string.\n */\nexport function cleanUrl(path: string): string {\n // If the path ends with an optional path parameter,\n // return it as-is.\n if (path.endsWith('?')) {\n return path\n }\n\n // Otherwise, remove the search and fragment from it.\n return path.replace(REDUNDANT_CHARACTERS_EXP, '')\n}\n"],"mappings":"AAAA,MAAM,2BAA2B;AAE1B,SAAS,gBAAgB,MAAc;AAC5C,SAAO,IAAI,IAAI,IAAI,IAAI,IAAI,kBAAkB,EAAE;AACjD;AAMO,SAAS,SAAS,MAAsB;AAG7C,MAAI,KAAK,SAAS,GAAG,GAAG;AACtB,WAAO;AAAA,EACT;AAGA,SAAO,KAAK,QAAQ,0BAA0B,EAAE;AAClD;","names":[]}