From 7ddaf4648f75836bcc528b192917497076b48528 Mon Sep 17 00:00:00 2001 From: Vivek Bhagat Date: Sat, 7 Sep 2024 15:37:01 +1000 Subject: [PATCH] #20681 Added support for single and double quotes for issue #20681 --- npm/ng-packs/packages/core/src/lib/utils/string-utils.ts | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/npm/ng-packs/packages/core/src/lib/utils/string-utils.ts b/npm/ng-packs/packages/core/src/lib/utils/string-utils.ts index 4c4950f58b6..a215c5c7494 100644 --- a/npm/ng-packs/packages/core/src/lib/utils/string-utils.ts +++ b/npm/ng-packs/packages/core/src/lib/utils/string-utils.ts @@ -17,8 +17,10 @@ export function createTokenParser(format: string) { } export function interpolate(text: string, params: string[]) { - return text - .replace(/(['"]?\{\s*(\d+)\s*\}['"]?)/g, (_, match, digit) => params[digit] ?? match) + return text + .replace(/(['"])?\{\s*(\d+)\s*\}\1/g, (_, quote, digit) => + (quote ? quote : '') + (params[digit] ?? `{${digit}}`) + (quote ? quote : '') + ) .replace(/\s+/g, ' '); }