From c087c45a4ce1de06088b40ef4bcb7e34e802c2c5 Mon Sep 17 00:00:00 2001 From: Charlie Greenman Date: Wed, 11 Sep 2024 05:49:50 -0400 Subject: [PATCH] fix --- src/replace.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/replace.ts b/src/replace.ts index 164ea0c..ad9fd74 100644 --- a/src/replace.ts +++ b/src/replace.ts @@ -41,12 +41,14 @@ export const replaceCurlyBrace = (mockParameters: Record, mockFileS } // Handle nested curly braces - while (/{.*}/.test(result)) { + let iterations = 0; + while (/{.*}/.test(result) && iterations < 3) { for (const key in mockParameters) { const value = mockParameters[key]; const processedValue = processValue(value, useKebabCase || false); result = result.replace(new RegExp(`{${key}}`, 'g'), processedValue); } + iterations++; } // Remove leading forward slash if present