dynamic-forms / Function

getParentPath

Gets the parent path from a nested path.

Presentation

function getParentPath(path: string): string;

Returns

string -

The parent path, or empty string if no parent

Parameters

NameTypeDescription
path
string

The path to get parent from

Example usage

getParentPath('parent.child.grandchild')
// 'parent.child'

getParentPath('topLevel')
// ''