isStandardSyntaxProperty.js 535 B

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