Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
selectors.each(selector => {
if (selector.type === parseSelector.SELECTOR) {
// Must contain at least one class or id
// body.foobar, html.foobar are not handled as they won't appear in a library
let skip = true;
selector.walk(node => {
const { type } = node;
if (type === parseSelector.CLASS || type === parseSelector.ID) {
skip = false;
}
});
if (skip) {
return;
}
// Insert a [data-zv=x.y.z] after the first class/attribute/id/tag
let interestedNode = null;
selector.walk(node => {
export function isSelector(node: { type: string } | undefined): node is SelectorParser.Selector {
if (node) {
return node.type === SelectorParser.SELECTOR;
} else {
return false;
}
}