isMathFunction.js 406 B

12345678910111213
  1. 'use strict';
  2. const MATH_FUNCTIONS = require('../reference/mathFunctions');
  3. /**
  4. * Check whether a node is math function
  5. *
  6. * @param {import('postcss-value-parser').Node} node postcss-value-parser node
  7. * @return {boolean} If `true`, the node is math function
  8. */
  9. module.exports = function isMathFunction(node) {
  10. return node.type === 'function' && MATH_FUNCTIONS.includes(node.value.toLowerCase());
  11. };