helpers.js 820 B

12345678910111213141516171819202122232425
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", { value: true });
  3. exports.groupSelectors = exports.getDocumentRoot = void 0;
  4. var positionals_1 = require("./positionals");
  5. function getDocumentRoot(node) {
  6. while (node.parent)
  7. node = node.parent;
  8. return node;
  9. }
  10. exports.getDocumentRoot = getDocumentRoot;
  11. function groupSelectors(selectors) {
  12. var filteredSelectors = [];
  13. var plainSelectors = [];
  14. for (var _i = 0, selectors_1 = selectors; _i < selectors_1.length; _i++) {
  15. var selector = selectors_1[_i];
  16. if (selector.some(positionals_1.isFilter)) {
  17. filteredSelectors.push(selector);
  18. }
  19. else {
  20. plainSelectors.push(selector);
  21. }
  22. }
  23. return [plainSelectors, filteredSelectors];
  24. }
  25. exports.groupSelectors = groupSelectors;