UNPKG

498 BJavaScriptView Raw
1const hashColorPattern = /^#[0-9a-fA-F]{6}$|^#[0-9a-fA-F]{3}$/;
2const unpaddedFractionalNumbersPattern = /\.[0-9]/;
3
4const isMixinToken = (token) => {
5 const [, symbol] = token;
6 const [char] = symbol;
7
8 return (
9 (char === '.' || char === '#') &&
10 // ignore hashes used for colors
11 hashColorPattern.test(symbol) === false &&
12 // ignore dots used for unpadded fractional numbers
13 unpaddedFractionalNumbersPattern.test(symbol) === false
14 );
15};
16
17module.exports = { isMixinToken };