Rush StackShopBlogEvents
Skip to main content

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

IReadonlyLookupByPath.findChildPath() 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.

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

Signature:

findChildPath(childPath: string, delimiter?: string): TItem | undefined;

Parameters

Parameter

Type

Description

childPath

string

delimiter

string

(Optional)

Returns:

TItem | undefined

the found item, or undefined if no item was found

Example

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