All files / src/matchers child.ts

100% Statements 5/5
100% Branches 2/2
100% Functions 1/1
100% Lines 5/5

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11  17x     17x 93x 20x   73x    
// Dependencies:
import { findMatches } from '../match';
import { TSQueryNode, TSQuerySelectorNode } from '../tsquery-types';
 
export function child (node: TSQueryNode, selector: TSQuerySelectorNode, ancestry: Array<TSQueryNode>): boolean {
    if (findMatches(node, selector.right, ancestry)) {
        return findMatches(ancestry[0], selector.left, ancestry.slice(1));
    }
    return false;
}