Selectionclassno test imports itclass Selection<T extends Node> implements Iterable<T>A lazy set of nodes of one type, in the order they were found; it can be read again.
| Member | Type | What it is |
|---|---|---|
run | () => Iterable<T> | |
parents | () => ParentIndex | |
__@iterator@281474976710661 | () => Iterator<T, any, any> | |
children | () => Selection<Node> | The children of each node. |
descendants | () => Selection<Node> | Every node below each node, in the order of the text. |
find | <K extends Kind>(kind: K) => Selection<NodeOf<K>> | The nodes of a kind below each node, typed as that kind. |
ofKind | <K extends Kind>(kind: K) => Selection<NodeOf<K>> | The nodes of a kind among these, typed as that kind. |
where | { <U extends T>(test: (n: T) => n is U): Selection<U>; (test: (n: T) => boolean): Selection<T>; } | The nodes for which a test holds; a type guard types the result. |
map | <U extends Node>(f: (n: T) => U | undefined) => Selection<U> | What f makes of each node; a node it makes nothing of (undefined) is left out. |
flatMap | <U extends Node>(f: (n: T) => Iterable<U>) => Selection<U> | The nodes f makes of each node, one after the other. |
parent | () => Selection<Node> | The parent of each node. |
ancestors | () => Selection<Node> | The ancestors of each node, nearest first. |
closest | <K extends Kind>(kind: K) => Selection<NodeOf<K>> | For each node, the nearest of it and its ancestors that is of the kind. |
unique | () => Selection<T> | The nodes with the repeats left out. |
toArray | () => T[] | The nodes, in an array. |
first | () => T | undefined | The first node, or undefined. |
count | () => number | How many nodes. |
some | (test: (n: T) => boolean) => boolean | Whether a test holds for some node. |
every | (test: (n: T) => boolean) => boolean | Whether a test holds for every node. |