HierarchyQuery Class
Package: @esfx/iter-query
Represents a sequence of hierarchically organized values.
Declaration
export declare class HierarchyQuery<TNode, T extends TNode = TNode> extends Query<T> implements HierarchyIterable<TNode, T>
Inherited Members
Constructors
constructor(source)
Constructs a new instance of the HierarchyQuery
class
Declaration
constructor(source: HierarchyIterable<TNode, T>);
Parameters
- source
- HierarchyIterable<TNode, T>
constructor(source, provider)
Constructs a new instance of the HierarchyQuery
class
Declaration
constructor(source: Iterable<T>, provider: HierarchyProvider<TNode>);
Parameters
- source
- Iterable<T>
- provider
- HierarchyProvider<TNode>
Methods
[Hierarchical.hierarchy]()
Declaration
[Hierarchical.hierarchy](): HierarchyProvider<TNode>;
Returns
ancestors(predicate)
Creates a subquery for the ancestors of each element in the hierarchy.
Declaration
ancestors<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
ancestors(predicate)
Creates a subquery for the ancestors of each element in the hierarchy.
Declaration
ancestors(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
ancestorsAndSelf(predicate)
Creates a subquery for the ancestors of each element as well as each element in the hierarchy.
Declaration
ancestorsAndSelf<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
ancestorsAndSelf(predicate)
Creates a subquery for the ancestors of each element as well as each element in the hierarchy.
Declaration
ancestorsAndSelf(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
bottomMost(predicate)
Creates a subquery for the bottom-most elements. Elements that are an ancestor of any other element are removed. Hierarchy
Declaration
bottomMost<U extends T>(predicate: (element: T) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: T) => element is U
Returns
bottomMost(predicate)
Creates a subquery for the bottom-most elements. Elements that are an ancestor of any other element are removed. Hierarchy
Declaration
bottomMost(predicate?: (element: T) => boolean): HierarchyQuery<TNode, T>;
Parameters
- predicate
- (element: T) => boolean
Returns
children(predicate)
Creates a subquery for the children of each element in the hierarchy.
Declaration
children<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
children(predicate)
Creates a subquery for the children of each element in the hierarchy.
Declaration
children(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
descendants(predicate)
Creates a subquery for the descendants of each element in the hierarchy.
Declaration
descendants<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
descendants(predicate)
Creates a subquery for the descendants of each element in the hierarchy.
Declaration
descendants(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
descendantsAndSelf(predicate)
Creates a subquery for the descendants of each element as well as each element in the hierarchy.
Declaration
descendantsAndSelf<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
descendantsAndSelf(predicate)
Creates a subquery for the descendants of each element as well as each element in the hierarchy.
Declaration
descendantsAndSelf(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
firstChild(predicate)
Creates a subquery for the first child of each element in the hierarchy.
Declaration
firstChild<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
firstChild(predicate)
Creates a subquery for the first child of each element in the hierarchy.
Declaration
firstChild(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
following(predicate)
Creates a subquery for the nodes following each element in the hierarchy.
Declaration
following<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
following(predicate)
Creates a subquery for the nodes following each element in the hierarchy.
Declaration
following(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
followingSiblings(predicate)
Creates a subquery for the siblings after each element in the hierarchy.
Declaration
followingSiblings<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
followingSiblings(predicate)
Creates a subquery for the siblings after each element in the hierarchy.
Declaration
followingSiblings(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
lastChild(predicate)
Creates a subquery for the last child of each element in the hierarchy.
Declaration
lastChild<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
lastChild(predicate)
Creates a subquery for the last child of each element in the hierarchy.
Declaration
lastChild(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
nthChild(offset, predicate)
Creates a subquery for the child of each element at the specified offset. A negative offset starts from the last child.
Declaration
nthChild<U extends TNode>(offset: number, predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
Returns
nthChild(offset, predicate)
Creates a subquery for the child of each element at the specified offset. A negative offset starts from the last child.
Declaration
nthChild(offset: number, predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
Returns
parents(predicate)
Creates a subquery for the parents of each element in the hierarchy.
Declaration
parents<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
parents(predicate)
Creates a subquery for the parents of each element in the hierarchy.
Declaration
parents(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
preceding(predicate)
Creates a subquery for the nodes preceding each element in the hierarchy.
Declaration
preceding<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
preceding(predicate)
Creates a subquery for the nodes preceding each element in the hierarchy.
Declaration
preceding(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
precedingSiblings(predicate)
Creates a subquery for the siblings before each element in the hierarchy.
Declaration
precedingSiblings<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
precedingSiblings(predicate)
Creates a subquery for the siblings before each element in the hierarchy.
Declaration
precedingSiblings(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
root(predicate)
Creates a subquery for the roots of each element in the hierarchy.
Declaration
root<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
root(predicate)
Creates a subquery for the roots of each element in the hierarchy.
Declaration
root(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
self(predicate)
Creates a subquery for this query
.
Declaration
self<U extends T>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
self(predicate)
Creates a subquery for this query
.
Declaration
self<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
self(predicate)
Creates a subquery for this query
.
Declaration
self(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
siblings(predicate)
Creates a subquery for the siblings of each element in the hierarchy.
Declaration
siblings<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
siblings(predicate)
Creates a subquery for the siblings of each element in the hierarchy.
Declaration
siblings(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
siblingsAfterSelf(predicate)
Creates a subquery for the siblings after each element in the hierarchy.
NOTE: This is an alias for followingSiblings
.
Declaration
siblingsAfterSelf<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
siblingsAfterSelf(predicate)
Creates a subquery for the siblings after each element in the hierarchy.
NOTE: This is an alias for followingSiblings
.
Declaration
siblingsAfterSelf(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
siblingsAndSelf(predicate)
Creates a subquery for the siblings of each element as well as each element in the hierarchy.
Declaration
siblingsAndSelf<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
siblingsAndSelf(predicate)
Creates a subquery for the siblings of each element as well as each element in the hierarchy.
Declaration
siblingsAndSelf(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
siblingsBeforeSelf(predicate)
Creates a subquery for the siblings before each element in the hierarchy.
NOTE: This is an alias for precedingSiblings
.
Declaration
siblingsBeforeSelf<U extends TNode>(predicate: (element: TNode) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: TNode) => element is U
A callback used to filter the results. Hierarchy
Returns
siblingsBeforeSelf(predicate)
Creates a subquery for the siblings before each element in the hierarchy.
NOTE: This is an alias for precedingSiblings
.
Declaration
siblingsBeforeSelf(predicate?: (element: TNode) => boolean): HierarchyQuery<TNode>;
Parameters
- predicate
- (element: TNode) => boolean
A callback used to filter the results. Hierarchy
Returns
topMost(predicate)
Creates a subquery for the top-most elements. Elements that are a descendant of any other element are removed. Hierarchy
Declaration
topMost<U extends T>(predicate: (element: T) => element is U): HierarchyQuery<TNode, U>;
Type Parameters
- U
Parameters
- predicate
- (element: T) => element is U
Returns
topMost(predicate)
Creates a subquery for the top-most elements. Elements that are a descendant of any other element are removed. Hierarchy
Declaration
topMost(predicate?: (element: T) => boolean): HierarchyQuery<TNode, T>;
Parameters
- predicate
- (element: T) => boolean
Returns