isFirstNodeOfRoot.cjs 538 B

1234567891011121314151617181920212223
  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. const typeGuards = require('./typeGuards.cjs');
  5. /**
  6. * @param {import('postcss').Node} node
  7. * @returns {boolean}
  8. */
  9. function isFirstNodeOfRoot(node) {
  10. if (typeGuards.isRoot(node)) return false;
  11. const parentNode = node.parent;
  12. if (!parentNode) {
  13. return false;
  14. }
  15. return typeGuards.isRoot(parentNode) && node === parentNode.first;
  16. }
  17. module.exports = isFirstNodeOfRoot;