Home > @microsoft/rush-lib > LookupByPath > findChildPath
LookupByPath.findChildPath() method
This API is provided as a 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): TItem | undefined;
Parameters
Parameter | Type | Description |
---|---|---|
childPath | string |
Returns:
TItem | undefined
the found item, or undefined
if no item was found
Example
const tree = new LookupByPath([['foo', 1], ['foo/bar', 2]]);
tree.findChildPath('foo/baz'); // returns 1
tree.findChildPath('foo/bar/baz'); // returns 2