.gitignore added
[dotfiles/.git] / .config / coc / extensions / node_modules / coc-prettier / node_modules / stylelint / lib / utils / isValidFontSize.js
1 /* @flow */
2 "use strict";
3
4 const keywordSets = require("../reference/keywordSets");
5 const valueParser = require("postcss-value-parser");
6
7 /**
8  * Check if a word is a font-size value.
9  */
10 module.exports = function(word /*: string*/) /*: boolean*/ {
11   if (!word) {
12     return false;
13   }
14
15   if (keywordSets.fontSizeKeywords.has(word)) {
16     return true;
17   }
18
19   const numberUnit = valueParser.unit(word);
20   if (!numberUnit) {
21     return false;
22   }
23
24   const unit = numberUnit.unit;
25
26   if (unit === "%") {
27     return true;
28   }
29   if (keywordSets.lengthUnits.has(unit.toLowerCase())) {
30     return true;
31   }
32
33   return false;
34 };