Skip to content

PromptScript API


Function: parsePath()

parsePath(path): ParsedPath

Defined in: core/src/utils/path.ts:34

Parse a PromptScript path reference.

Parameters

path

string

Path string to parse

Returns

ParsedPath

Parsed path components

Throws

If path format is invalid

Example

parsePath('@core/guards/compliance@1.0.0')
// { namespace: 'core', segments: ['guards', 'compliance'], version: '1.0.0', isRelative: false }

parsePath('./local/file')
// { namespace: undefined, segments: ['local', 'file'], version: undefined, isRelative: true }