isStandardSyntaxFunction.js 548 B

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. /**
  3. * Check whether a function is standard
  4. *
  5. * @param {import('postcss-value-parser').Node} node
  6. * @returns {boolean}
  7. */
  8. module.exports = function isStandardSyntaxFunction(node) {
  9. // Function nodes without names are things in parentheses like Sass lists
  10. if (!node.value) {
  11. return false;
  12. }
  13. if (node.value.startsWith('#{')) {
  14. return false;
  15. }
  16. // CSS-in-JS interpolation
  17. if (node.value.startsWith('${')) {
  18. return false;
  19. }
  20. // CSS-in-JS syntax
  21. if (node.value.startsWith('`')) {
  22. return false;
  23. }
  24. return true;
  25. };