{"version":3,"file":"url-pattern-to-string.function-BAOMgyZQ.js","sources":["../../../src/packages/core/utils/path/url-pattern-to-string.function.ts"],"sourcesContent":["export type UrlParametersRecord = Record string } | null>;\n\nconst PARAM_IDENTIFIER = /:([^/]+)/g;\n\n/**\n *\n * @param pattern\n * @param params\n */\nexport function umbUrlPatternToString(pattern: string, params: UrlParametersRecord | null): string {\n\treturn params\n\t\t? pattern.replace(PARAM_IDENTIFIER, (_substring: string, ...args: string[]) => {\n\t\t\t\tconst segmentValue = params![args[0]]; // (segmentValue is the value to replace the parameter)\n\t\t\t\t// Replace the path-segment with the value from the params object or 'null' if it doesn't exist\n\t\t\t\treturn segmentValue === undefined ? `:${args[0]}` : segmentValue === null ? 'null' : segmentValue.toString();\n\t\t\t})\n\t\t: pattern;\n}\n"],"names":["PARAM_IDENTIFIER","umbUrlPatternToString","pattern","params","_substring","args","segmentValue"],"mappings":"AAEA,MAAMA,IAAmB;AAOT,SAAAC,EAAsBC,GAAiBC,GAA4C;AAClG,SAAOA,IACJD,EAAQ,QAAQF,GAAkB,CAACI,MAAuBC,MAAmB;AAC7E,UAAMC,IAAeH,EAAQE,EAAK,CAAC,CAAC;AAE7B,WAAAC,MAAiB,SAAY,IAAID,EAAK,CAAC,CAAC,KAAKC,MAAiB,OAAO,SAASA,EAAa,SAAS;AAAA,EAC3G,CAAA,IACAJ;AACJ;"}