Final convertions

This commit is contained in:
Adria Navarro 2024-02-21 19:57:05 +01:00
parent 4aa8456d21
commit 813b96354b
2 changed files with 5 additions and 5 deletions

View File

@ -65,4 +65,4 @@ export function unregisterAll(handlebars) {
externalHelperNames = [] externalHelperNames = []
} }
export const externalHelperNames = [] export let externalHelperNames = []

View File

@ -17,8 +17,8 @@ export const isJSAllowed = () => {
// original regex: /(?<!{){{[^{}]+}}(?!})/g // original regex: /(?<!{){{[^{}]+}}(?!})/g
export const findDoubleHbsInstances = string => { export const findDoubleHbsInstances = string => {
let copied = string let copied = string
const doubleRegex = new RegExp(exports.FIND_HBS_REGEX) const doubleRegex = new RegExp(FIND_HBS_REGEX)
const regex = new RegExp(exports.FIND_TRIPLE_HBS_REGEX) const regex = new RegExp(FIND_TRIPLE_HBS_REGEX)
const tripleMatches = copied.match(regex) const tripleMatches = copied.match(regex)
// remove triple braces // remove triple braces
if (tripleMatches) { if (tripleMatches) {
@ -42,14 +42,14 @@ export const removeHandlebarsStatements = (
string, string,
replacement = "Invalid binding" replacement = "Invalid binding"
) => { ) => {
let regexp = new RegExp(exports.FIND_HBS_REGEX) let regexp = new RegExp(FIND_HBS_REGEX)
let matches = string.match(regexp) let matches = string.match(regexp)
if (matches == null) { if (matches == null) {
return string return string
} }
for (let match of matches) { for (let match of matches) {
const idx = string.indexOf(match) const idx = string.indexOf(match)
string = exports.swapStrings(string, idx, match.length, replacement) string = swapStrings(string, idx, match.length, replacement)
} }
return string return string
} }