Rush StackShopBlogEvents
Skip to main content

Home > @rushstack/lookup-by-path > LookupByPath > iteratePathSegments

LookupByPath.iteratePathSegments() 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 segments of a serialized path.

Signature:

static iteratePathSegments(serializedPath: string, delimiter?: string): Iterable<string>;

Parameters

Parameter

Type

Description

serializedPath

string

delimiter

string

(Optional)

Returns:

Iterable<string>

Example

LookupByPath.iteratePathSegments('foo/bar/baz') yields 'foo', 'bar', 'baz'

LookupByPath.iteratePathSegments('foo\\bar\\baz', '\\') yields 'foo', 'bar', 'baz'