Skip to content

Commit

Permalink
Fix is-nth-child predicate (#1533)
Browse files Browse the repository at this point in the history
  • Loading branch information
pokey authored Jun 15, 2023
1 parent fcdf70c commit 2b0a50c
Showing 1 changed file with 1 addition and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ class IsNthChild extends QueryPredicateOperator<IsNthChild> {
name = "is-nth-child?" as const;
schema = z.tuple([q.node, q.integer]);
run({ node }: MutableQueryCapture, n: number) {
return node.parent?.children.indexOf(node) === n;
return node.parent?.children.findIndex((n) => n.id === node.id) === n;
}
}

Expand Down

0 comments on commit 2b0a50c

Please sign in to comment.