isScssVariable.js 436 B

123456789101112131415161718192021
  1. 'use strict';
  2. /**
  3. * Check whether a property is SCSS variable
  4. *
  5. * @param {string} property
  6. * @returns {boolean}
  7. */
  8. module.exports = function isScssVariable(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 true;
  12. }
  13. // SCSS var within a namespace (e.g. namespace.$var: x)
  14. if (property.includes('.$')) {
  15. return true;
  16. }
  17. return false;
  18. };