src/services/placeholders.cjs
BeforeProposed
+1−1
33 const counts = new Map();
44 const matcher = /\{([a-z][a-z0-9_]*)\}/g;
55 let match;
6 while ((match = matcher.exec(text))) counts.set(match[1], 1);
6 while ((match = matcher.exec(text))) counts.set(match[1], (counts.get(match[1]) || 0) + 1);
77 const stripped = text.replace(matcher, '');
88 requireValue(!/[{}]/.test(stripped), 'invalid placeholder syntax');
99 return [...counts.entries()].sort(([a],[b]) => a.localeCompare(b, 'en'));