forked from mystiq/hydrogen-web
Remove stray "--" from code
This commit is contained in:
parent
19a6d669a9
commit
5d4323cd1d
1 changed files with 3 additions and 3 deletions
|
@ -21,7 +21,7 @@ let resolvedMap;
|
||||||
let baseVariables;
|
let baseVariables;
|
||||||
|
|
||||||
function getValueFromAlias(alias) {
|
function getValueFromAlias(alias) {
|
||||||
const derivedVariable = aliasMap.get(`--${alias}`);
|
const derivedVariable = aliasMap.get(alias);
|
||||||
return baseVariables.get(derivedVariable) ?? resolvedMap.get(derivedVariable);
|
return baseVariables.get(derivedVariable) ?? resolvedMap.get(derivedVariable);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -39,13 +39,13 @@ function parseDeclarationValue(value) {
|
||||||
}
|
}
|
||||||
|
|
||||||
function resolveDerivedVariable(decl, derive) {
|
function resolveDerivedVariable(decl, derive) {
|
||||||
const RE_VARIABLE_VALUE = /--(.+)--(.+)-(.+)/;
|
const RE_VARIABLE_VALUE = /(--.+)--(.+)-(.+)/;
|
||||||
const variableCollection = parseDeclarationValue(decl.value);
|
const variableCollection = parseDeclarationValue(decl.value);
|
||||||
for (const variable of variableCollection) {
|
for (const variable of variableCollection) {
|
||||||
const matches = variable.match(RE_VARIABLE_VALUE);
|
const matches = variable.match(RE_VARIABLE_VALUE);
|
||||||
if (matches) {
|
if (matches) {
|
||||||
const [wholeVariable, baseVariable, operation, argument] = matches;
|
const [wholeVariable, baseVariable, operation, argument] = matches;
|
||||||
const value = baseVariables.get(`--${baseVariable}`) ?? getValueFromAlias(baseVariable);
|
const value = baseVariables.get(baseVariable) ?? getValueFromAlias(baseVariable);
|
||||||
if (!value) {
|
if (!value) {
|
||||||
throw new Error(`Cannot derive from ${baseVariable} because it is neither defined in config nor is it an alias!`);
|
throw new Error(`Cannot derive from ${baseVariable} because it is neither defined in config nor is it an alias!`);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue