Welcome to mirror list, hosted at ThFree Co, Russian Federation.

mixin.js « nodes « lib « postcss-less « node_modules « assets - github.com/fourtyone11/origin-hugo-theme.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: ba3cb5f495798ca19b9a8b1d3036a5a8f6ee66cd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
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 };