splitPath()function
splitPath(path: PossiblePath): readonly string[]
| Param | Type | |
|---|---|---|
path | PossiblePath | Path to split (an array of segments is returned as-is). required |
| Return | |
|---|---|
readonly string[] | Array of path segments. |
Get the "segments" in an absolute path.
splitPath("/")returns[]— the root has no segments.
Examples
splitPath("/a/b") // ["a", "b"]