4
0

isStandardSyntaxFunction.mjs 530 B

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