7 lines
390 B
JavaScript
7 lines
390 B
JavaScript
const checkStringStartsWith = (token) => (key) => typeof key === "string" && key.startsWith(token);
|
|
const isCSSVariableName = checkStringStartsWith("--");
|
|
const isCSSVariableToken = checkStringStartsWith("var(--");
|
|
const cssVariableRegex = /var\s*\(\s*--[\w-]+(\s*,\s*(?:(?:[^)(]|\((?:[^)(]+|\([^)(]*\))*\))*)+)?\s*\)/g;
|
|
|
|
export { cssVariableRegex, isCSSVariableName, isCSSVariableToken };
|