Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/lookup-by-path

lookup-by-path package

Strongly typed trie data structure for path and URL-like strings.

Classes

Class

Description

LookupByPath

(BETA) This class is used to associate path-like-strings, such as those returned by git commands, with entities that correspond with ancestor folders, such as Rush Projects or npm packages.

It is optimized for efficiently locating the nearest ancestor path with an associated value.

It is implemented as a Trie (https://en.wikipedia.org/wiki/Trie) data structure, with each edge being a path segment.

Functions

Function

Description

getFirstDifferenceInCommonNodes(options)

(BETA) Recursively compares two path tries to find the first shared node with a different value.

Interfaces

Interface

Description

IGetFirstDifferenceInCommonNodesOptions

(BETA) Options for the getFirstDifferenceInCommonNodes function.

IPrefixMatch

(BETA) Object containing both the matched item and the start index of the remainder of the query.

IReadonlyLookupByPath

(BETA) The readonly component of LookupByPath, to simplify unit testing.

IReadonlyPathTrieNode

(BETA) Readonly view of a node in the path trie used in LookupByPath