3 exports.__esModule = true;
4 exports.isUniversal = exports.isTag = exports.isString = exports.isSelector = exports.isRoot = exports.isPseudo = exports.isNesting = exports.isIdentifier = exports.isComment = exports.isCombinator = exports.isClassName = exports.isAttribute = undefined;
6 var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; };
10 exports.isNode = isNode;
11 exports.isPseudoElement = isPseudoElement;
12 exports.isPseudoClass = isPseudoClass;
13 exports.isContainer = isContainer;
14 exports.isNamespace = isNamespace;
16 var _types = require("./types");
18 var IS_TYPE = (_IS_TYPE = {}, _IS_TYPE[_types.ATTRIBUTE] = true, _IS_TYPE[_types.CLASS] = true, _IS_TYPE[_types.COMBINATOR] = true, _IS_TYPE[_types.COMMENT] = true, _IS_TYPE[_types.ID] = true, _IS_TYPE[_types.NESTING] = true, _IS_TYPE[_types.PSEUDO] = true, _IS_TYPE[_types.ROOT] = true, _IS_TYPE[_types.SELECTOR] = true, _IS_TYPE[_types.STRING] = true, _IS_TYPE[_types.TAG] = true, _IS_TYPE[_types.UNIVERSAL] = true, _IS_TYPE);
20 function isNode(node) {
21 return (typeof node === "undefined" ? "undefined" : _typeof(node)) === "object" && IS_TYPE[node.type];
24 function isNodeType(type, node) {
25 return isNode(node) && node.type === type;
28 var isAttribute = exports.isAttribute = isNodeType.bind(null, _types.ATTRIBUTE);
29 var isClassName = exports.isClassName = isNodeType.bind(null, _types.CLASS);
30 var isCombinator = exports.isCombinator = isNodeType.bind(null, _types.COMBINATOR);
31 var isComment = exports.isComment = isNodeType.bind(null, _types.COMMENT);
32 var isIdentifier = exports.isIdentifier = isNodeType.bind(null, _types.ID);
33 var isNesting = exports.isNesting = isNodeType.bind(null, _types.NESTING);
34 var isPseudo = exports.isPseudo = isNodeType.bind(null, _types.PSEUDO);
35 var isRoot = exports.isRoot = isNodeType.bind(null, _types.ROOT);
36 var isSelector = exports.isSelector = isNodeType.bind(null, _types.SELECTOR);
37 var isString = exports.isString = isNodeType.bind(null, _types.STRING);
38 var isTag = exports.isTag = isNodeType.bind(null, _types.TAG);
39 var isUniversal = exports.isUniversal = isNodeType.bind(null, _types.UNIVERSAL);
41 function isPseudoElement(node) {
42 return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value === ":before" || node.value === ":after");
44 function isPseudoClass(node) {
45 return isPseudo(node) && !isPseudoElement(node);
48 function isContainer(node) {
49 return !!(isNode(node) && node.walk);
52 function isNamespace(node) {
53 return isClassName(node) || isAttribute(node) || isTag(node);