mixin.js 498 B

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