isStandardSyntaxFunction.cjs 717 B

12345678910111213141516171819202122232425262728293031323334
  1. // NOTICE: This file is generated by Rollup. To modify it,
  2. // please instead edit the ESM counterpart and rebuild with Rollup (npm run build).
  3. 'use strict';
  4. /**
  5. * Check whether a function is standard
  6. *
  7. * @param {import('postcss-value-parser').Node} node
  8. * @returns {boolean}
  9. */
  10. function isStandardSyntaxFunction(node) {
  11. // Function nodes without names are things in parentheses like Sass lists
  12. if (!node.value) {
  13. return false;
  14. }
  15. if (node.value.startsWith('#{')) {
  16. return false;
  17. }
  18. // CSS-in-JS interpolation
  19. if (node.value.startsWith('${')) {
  20. return false;
  21. }
  22. // CSS-in-JS syntax
  23. if (node.value.startsWith('`')) {
  24. return false;
  25. }
  26. return true;
  27. }
  28. module.exports = isStandardSyntaxFunction;