sxoinas12 82e781b8aa Graph & Tree | 5 жил өмнө | |
---|---|---|
.. | ||
index.js | 5 жил өмнө | |
license | 5 жил өмнө | |
package.json | 5 жил өмнө | |
readme.md | 5 жил өмнө |
Node.js
path.dirname()
ponyfill
This was needed in order to expose path.posix.dirname()
on Node.js v0.10
$ npm install --save path-dirname
const pathDirname = require('path-dirname');
pathDirname('/home/foo');
//=> '/home'
pathDirname('C:\\Users\\foo');
//=> 'C:\\Users'
pathDirname('foo');
//=> '.'
pathDirname('foo/bar');
//=> 'foo'
//Using posix version for consistent output when dealing with glob escape chars
pathDirname.win32('C:\\Users\\foo/\\*bar');
//=> 'C:\\Users\\foo/'
pathDirname.posix('C:\\Users\\foo/\\*bar');
//=> 'C:\\Users\\foo'
See the path.dirname()
docs.
POSIX specific version.
Windows specific version.
MIT