{"version":3,"file":"url-pattern-to-string.function-CJilE3T1.js","sources":["../../../src/packages/core/utils/path/url-pattern-to-string.function.ts"],"sourcesContent":["export type UrlParametersRecord = Record string } | null>;\r\n\r\nconst PARAM_IDENTIFIER = /:([^/]+)/g;\r\n\r\n/**\r\n *\r\n * @param pattern\r\n * @param params\r\n */\r\nexport function umbUrlPatternToString(pattern: string, params: UrlParametersRecord | null): string {\r\n\treturn params\r\n\t\t? pattern.replace(PARAM_IDENTIFIER, (_substring: string, ...args: string[]) => {\r\n\t\t\t\tconst segmentValue = params![args[0]]; // (segmentValue is the value to replace the parameter)\r\n\t\t\t\t// Replace the path-segment with the value from the params object or 'null' if it doesn't exist\r\n\t\t\t\treturn segmentValue === undefined ? `:${args[0]}` : segmentValue === null ? 'null' : segmentValue.toString();\r\n\t\t\t})\r\n\t\t: pattern;\r\n}\r\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;"}