Rush StackShopBlogEvents
Skip to main content

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

IReadonlyLookupByPath.entries() method

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.

Iterates over the entries in this trie.

Signature:

entries(query?: string, delimiter?: string): IterableIterator<[string, TItem]>;

Parameters

Parameter

Type

Description

query

string

(Optional) An optional query. If specified only entries that start with the query will be returned.

delimiter

string

(Optional)

Returns:

IterableIterator<[string, TItem]>

An iterator over the entries under the specified query (or the root if no query is specified).

Remarks

Keys in the returned iterator use the provided delimiter to join segments. Iteration order is not specified.

Example

const trie = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
[...trie.entries(undefined, ',')); // returns [['foo', 1], ['foo,bar', 2]]