Node
Get the node at a specific path, asserting that it is an ancestor node. If the specified node is not an ancestor node, throw an error.
Return a generator of all the ancestor nodes above a specific path. By default, the order is bottom-up, from lowest to highest ancestor in the tree, but you can pass the reverse: true option to go top-down.
Options: {reverse?: boolean}
Get the child of a node at the specified index.
Iterate over the children of a node at a specific path.
Options: {reverse?: boolean}
Get an entry for the common ancestor node of two paths.
Get the node at a specific path, asserting that it's a descendant node.
Return a generator of all the descendant node entries inside a root node. Each iteration will return a NodeEntry tuple consisting of [Node, Path].
Options: {from?: Path, to?: Path, reverse?: boolean, pass?: (node: NodeEntry => boolean)}
Return a generator of all the element nodes inside a root node. Each iteration will return an ElementEntry tuple consisting of [Element, Path]. If the root node is an element, it will be included in the iteration as well.
Options: {from?: Path, to?: Path, reverse?: boolean, pass?: (node: NodeEntry => boolean)}
Get the first node entry in a root node from a path.
Get the sliced fragment represented by the range.
Get the descendant node referred to by a specific path. If the path is an empty array, get the root node itself.
Get the last node entry in a root node at a specific path.
Get the node at a specific path, ensuring it's a leaf text node. If the node is not a leaf text node, throw an error.
Return a generator of the nodes in a branch of the tree, from a specific path. By default, the order is top-down, from the lowest to the highest node in the tree, but you can pass the reverse: true option to go bottom-up.
Options: {reverse?: boolean}
Return a generator of all the node entries of a root node. Each entry is returned as a [Node, Path] tuple, with the path referring to the node's position inside the root node.
Options: {from?: Path, to?: Path, reverse?: boolean, pass?: (node: NodeEntry => boolean)}
Get the parent of a node at a specific path.
Methods related to Text.
Get the concatenated text string of a node's content. Note that this will not include spaces or line breaks between block nodes. This is not intended as a user-facing string, but as a string for performing offset-related computations for a node.
Return a generator of all leaf text nodes in a root node.
Options: {from?: Path, to?: Path, reverse?: boolean, pass?: (node: NodeEntry => boolean)}
Methods used to check some attribute of a Node.
Check if a descendant node exists at a specific path.
Check if a value implements the Node interface.
Check if a value is a list of Node objects.
Check if a node matches a set of props.