isKeyframeRule.js 361 B

12345678910111213141516171819
  1. 'use strict';
  2. const { isAtRule } = require('./typeGuards');
  3. /**
  4. * Check if a rule is a keyframe one
  5. *
  6. * @param {import('postcss').Rule} rule
  7. * @returns {boolean}
  8. */
  9. module.exports = function isKeyframeRule(rule) {
  10. const parent = rule.parent;
  11. if (!parent) {
  12. return false;
  13. }
  14. return isAtRule(parent) && parent.name.toLowerCase() === 'keyframes';
  15. };