Function: dirname()
ts
function dirname(path): string;获取路径中的目录部分。
Parameters
| Parameter | Type | Description |
|---|---|---|
path | string | 要处理的路径 |
Returns
string
路径的目录部分
Example
ts
dirname('/foo/bar/baz.html') // => '/foo/bar'
dirname('/foo/bar/baz') // => '/foo/bar'
dirname('/foo/bar/') // => '/foo'
dirname('/foo') // => '/'
dirname('foo') // => '.'Since
1.0.0