Use startsWith instead of regex testing

This commit is contained in:
RMidhunSuresh 2022-03-07 13:25:53 +05:30
parent a5d46bb40c
commit 41f6b6ab6b

View file

@ -37,9 +37,8 @@ function resolveDerivedVariable(decl, variables) {
} }
function extractAlias(decl) { function extractAlias(decl) {
const RE_VARIABLE_PROP = /--(.+)/;
const wholeVariable = decl.value.match(RE_VARIABLE_VALUE)?.[1]; const wholeVariable = decl.value.match(RE_VARIABLE_VALUE)?.[1];
if (RE_VARIABLE_PROP.test(decl.prop) && wholeVariable) { if (decl.prop.startsWith("--") && wholeVariable) {
aliasMap.set(decl.prop, wholeVariable); aliasMap.set(decl.prop, wholeVariable);
} }
} }