source: trip-planner-front/node_modules/postcss-selector-parser/dist/selectors/guards.js@ 571e0df

Last change on this file since 571e0df was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 2.5 KB
Line 
1"use strict";
2
3exports.__esModule = true;
4exports.isNode = isNode;
5exports.isPseudoElement = isPseudoElement;
6exports.isPseudoClass = isPseudoClass;
7exports.isContainer = isContainer;
8exports.isNamespace = isNamespace;
9exports.isUniversal = exports.isTag = exports.isString = exports.isSelector = exports.isRoot = exports.isPseudo = exports.isNesting = exports.isIdentifier = exports.isComment = exports.isCombinator = exports.isClassName = exports.isAttribute = void 0;
10
11var _types = require("./types");
12
13var _IS_TYPE;
14
15var 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);
16
17function isNode(node) {
18 return typeof node === "object" && IS_TYPE[node.type];
19}
20
21function isNodeType(type, node) {
22 return isNode(node) && node.type === type;
23}
24
25var isAttribute = isNodeType.bind(null, _types.ATTRIBUTE);
26exports.isAttribute = isAttribute;
27var isClassName = isNodeType.bind(null, _types.CLASS);
28exports.isClassName = isClassName;
29var isCombinator = isNodeType.bind(null, _types.COMBINATOR);
30exports.isCombinator = isCombinator;
31var isComment = isNodeType.bind(null, _types.COMMENT);
32exports.isComment = isComment;
33var isIdentifier = isNodeType.bind(null, _types.ID);
34exports.isIdentifier = isIdentifier;
35var isNesting = isNodeType.bind(null, _types.NESTING);
36exports.isNesting = isNesting;
37var isPseudo = isNodeType.bind(null, _types.PSEUDO);
38exports.isPseudo = isPseudo;
39var isRoot = isNodeType.bind(null, _types.ROOT);
40exports.isRoot = isRoot;
41var isSelector = isNodeType.bind(null, _types.SELECTOR);
42exports.isSelector = isSelector;
43var isString = isNodeType.bind(null, _types.STRING);
44exports.isString = isString;
45var isTag = isNodeType.bind(null, _types.TAG);
46exports.isTag = isTag;
47var isUniversal = isNodeType.bind(null, _types.UNIVERSAL);
48exports.isUniversal = isUniversal;
49
50function isPseudoElement(node) {
51 return isPseudo(node) && node.value && (node.value.startsWith("::") || node.value.toLowerCase() === ":before" || node.value.toLowerCase() === ":after");
52}
53
54function isPseudoClass(node) {
55 return isPseudo(node) && !isPseudoElement(node);
56}
57
58function isContainer(node) {
59 return !!(isNode(node) && node.walk);
60}
61
62function isNamespace(node) {
63 return isAttribute(node) || isTag(node);
64}
Note: See TracBrowser for help on using the repository browser.