Resolve variables in /fuzzy

This commit is contained in:
Cohee
2023-11-24 17:41:49 +02:00
parent adb3badcc1
commit 2c8e855385
2 changed files with 14 additions and 2 deletions

View File

@ -69,6 +69,18 @@ function addGlobalVariable(name, value) {
return newValue;
}
export function resolveVariable(name) {
if (existsLocalVariable(name)) {
return getLocalVariable(name);
}
if (existsGlobalVariable(name)) {
return getGlobalVariable(name);
}
return name;
}
export function replaceVariableMacros(str) {
// Replace {{getvar::name}} with the value of the variable name
str = str.replace(/{{getvar::([^}]+)}}/gi, (_, name) => {