From a55ffc274de4b810ad1d9c6a6c1c9cbd0f02839e Mon Sep 17 00:00:00 2001 From: shellscape Date: Sat, 18 Apr 2020 20:09:45 -0400 Subject: [PATCH] refactor: tweak regex variable names --- lib/nodes/Func.js | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) 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); } }