Skip to content

Commit

Permalink
chore(morphix): improve regexp
Browse files Browse the repository at this point in the history
  • Loading branch information
PierreDemailly committed Oct 29, 2023
1 parent eb7f2b1 commit a1e6edc
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/morphix/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ export async function morphix(
return await kFunctions[func](String(transformedValue));
};

const braceFnRegex = /{\s*([a-z0-9-.]*)\s*(?:\|\s*((?:(?!{)[a-z0-9-.]*)*?)\s*)?}/gi;
const braceFnRegex = /{\s{0,1}([a-z0-9-.]*)\s{0,1}(?:\|\s{0,1}((?:(?!{)[a-z0-9-]*)*?)\s{0,1})?}/gi;
let formattedTemplate = template;

for (const [match, placeholder, func] of template.matchAll(braceFnRegex)) {
Expand Down

0 comments on commit a1e6edc

Please sign in to comment.