Skip to content

Commit a55ffc2

Browse files
committed
refactor: tweak regex variable names
1 parent 9189daa commit a55ffc2

File tree

1 file changed

+5
-7
lines changed

1 file changed

+5
-7
lines changed

lib/nodes/Func.js

+5-7
Original file line numberDiff line numberDiff line change
@@ -87,10 +87,9 @@ const allFunctions = [
8787
const vendorPrefixes = ['-webkit-', '-moz-', '-ms-', '-o-'];
8888
const reFunctions = new RegExp(`^(${vendorPrefixes.join('|')})?(${allFunctions.join('|')})`, 'i');
8989
const rePunctuation = new RegExp(`^(\\${Punctuation.chars.join('|\\')})`);
90-
91-
const colorFunctionsRegex = /^(hsla?|hwb|lab|lch|rgba?)$/i;
92-
const varFunctionRegex = /^var$/i;
93-
const varPrefixRegex = /^--[^\s]+$/;
90+
const reColorFunctions = /^(hsla?|hwb|lab|lch|rgba?)$/i;
91+
const reVar = /^var$/i;
92+
const reVarPrefix = /^--[^\s]+$/;
9493

9594
class Func extends Container {
9695
constructor(options = {}) {
@@ -192,9 +191,8 @@ class Func extends Container {
192191

193192
const { lastNode } = parser;
194193
const { nodes } = node;
195-
lastNode.isColor = colorFunctionsRegex.test(lastNode.name);
196-
lastNode.isVar =
197-
varFunctionRegex.test(lastNode.name) && nodes.length && varPrefixRegex.test(nodes[0].value);
194+
lastNode.isColor = reColorFunctions.test(lastNode.name);
195+
lastNode.isVar = reVar.test(lastNode.name) && nodes.length && reVarPrefix.test(nodes[0].value);
198196
}
199197
}
200198

0 commit comments

Comments
 (0)