Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/lookup-by-path > IReadonlyLookupByPath

IReadonlyLookupByPath interface

This API is provided as a beta preview for developers and may change based on feedback that we receive. Do not use this API in a production environment.

The readonly component of LookupByPath, to simplify unit testing.

Signature:

export interface IReadonlyLookupByPath<TItem extends {}> extends Iterable<[string, TItem]> 

Extends: Iterable<[string, TItem]>

Methods

Method

Description

[Symbol.iterator](query, delimiter)

(BETA) Iterates over the entries in this trie.

entries(query, delimiter)

(BETA) Iterates over the entries in this trie.

findChildPath(childPath, delimiter)

(BETA) Searches for the item associated with childPath, or the nearest ancestor of that path that has an associated item.

findChildPathFromSegments(childPathSegments)

(BETA) Searches for the item associated with childPathSegments, or the nearest ancestor of that path that has an associated item.

findLongestPrefixMatch(query, delimiter)

(BETA) Searches for the item for which the recorded prefix is the longest matching prefix of query. Obtains both the item and the length of the matched prefix, so that the remainder of the path can be extracted.

get(query, delimiter)

(BETA) Retrieves the entry that exists exactly at the specified path, if any.

getNodeAtPrefix(query, delimiter)

(BETA) Retrieves the trie node at the specified prefix, if it exists.

groupByChild(infoByPath, delimiter)

(BETA) Groups the provided map of info by the nearest entry in the trie that contains the path. If the path is not found in the trie, the info is ignored.

has(query, delimiter)

(BETA) Determines if an entry exists exactly at the specified path.