You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
498 B
JavaScript
18 lines
498 B
JavaScript
2 years ago
|
const hashColorPattern = /^#[0-9a-fA-F]{6}$|^#[0-9a-fA-F]{3}$/;
|
||
|
const unpaddedFractionalNumbersPattern = /\.[0-9]/;
|
||
|
|
||
|
const isMixinToken = (token) => {
|
||
|
const [, symbol] = token;
|
||
|
const [char] = symbol;
|
||
|
|
||
|
return (
|
||
|
(char === '.' || char === '#') &&
|
||
|
// ignore hashes used for colors
|
||
|
hashColorPattern.test(symbol) === false &&
|
||
|
// ignore dots used for unpadded fractional numbers
|
||
|
unpaddedFractionalNumbersPattern.test(symbol) === false
|
||
|
);
|
||
|
};
|
||
|
|
||
|
module.exports = { isMixinToken };
|