Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
CharlieGreenman committed Sep 11, 2024
1 parent c18047c commit c087c45
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/replace.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,12 +41,14 @@ export const replaceCurlyBrace = (mockParameters: Record<string, any>, 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
Expand Down

0 comments on commit c087c45

Please sign in to comment.