One final change, match is likely better than matchAll due to the global nature of the regex and its lack of capture groups currently (in workflow mustache cleansing).
This commit is contained in:
parent
5965a04979
commit
fca788f424
|
@ -10,10 +10,10 @@ function cleanMustache(string) {
|
||||||
"]": "",
|
"]": "",
|
||||||
}
|
}
|
||||||
let regex = new RegExp(/{{[^}}]*}}/g)
|
let regex = new RegExp(/{{[^}}]*}}/g)
|
||||||
for (let match of string.matchAll(regex)) {
|
for (let match of string.match(regex)) {
|
||||||
let baseIdx = string.indexOf(match)
|
let baseIdx = string.indexOf(match)
|
||||||
for (let key of Object.keys(charToReplace)) {
|
for (let key of Object.keys(charToReplace)) {
|
||||||
let idxChar = match[0].indexOf(key)
|
let idxChar = match.indexOf(key)
|
||||||
if (idxChar !== -1) {
|
if (idxChar !== -1) {
|
||||||
string =
|
string =
|
||||||
string.slice(baseIdx, baseIdx + idxChar) +
|
string.slice(baseIdx, baseIdx + idxChar) +
|
||||||
|
|
Loading…
Reference in New Issue