diff --git a/lib/nodes/Func.js b/lib/nodes/Func.js index 53665bf..2cf5711 100644 --- a/lib/nodes/Func.js +++ b/lib/nodes/Func.js @@ -87,10 +87,9 @@ const allFunctions = [ const vendorPrefixes = ['-webkit-', '-moz-', '-ms-', '-o-']; const reFunctions = new RegExp(`^(${vendorPrefixes.join('|')})?(${allFunctions.join('|')})`, 'i'); const rePunctuation = new RegExp(`^(\\${Punctuation.chars.join('|\\')})`); - -const colorFunctionsRegex = /^(hsla?|hwb|lab|lch|rgba?)$/i; -const varFunctionRegex = /^var$/i; -const varPrefixRegex = /^--[^\s]+$/; +const reColorFunctions = /^(hsla?|hwb|lab|lch|rgba?)$/i; +const reVar = /^var$/i; +const reVarPrefix = /^--[^\s]+$/; class Func extends Container { constructor(options = {}) { @@ -192,9 +191,8 @@ class Func extends Container { const { lastNode } = parser; const { nodes } = node; - lastNode.isColor = colorFunctionsRegex.test(lastNode.name); - lastNode.isVar = - varFunctionRegex.test(lastNode.name) && nodes.length && varPrefixRegex.test(nodes[0].value); + lastNode.isColor = reColorFunctions.test(lastNode.name); + lastNode.isVar = reVar.test(lastNode.name) && nodes.length && reVarPrefix.test(nodes[0].value); } }