UNPKG

535 BJavaScriptView Raw
1/**
2 * Check whether a property is standard
3 *
4 * @param {string} property
5 * @return {boolean} If `true`, the property is standard
6 */
7
8module.exports = function isStandardSyntaxProperty(property) {
9 // SCSS var (e.g. $var: x), list (e.g. $list: (x)) or map (e.g. $map: (key:value))
10 if (property.startsWith('$')) {
11 return false;
12 }
13
14 // Less var (e.g. @var: x)
15 if (property.startsWith('@')) {
16 return false;
17 }
18
19 // SCSS or Less interpolation
20 if (/#{.+?}|@{.+?}|\$\(.+?\)/.test(property)) {
21 return false;
22 }
23
24 return true;
25};