You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

readme.md 1.0KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. # path-dirname [![Build Status](https://travis-ci.org/es128/path-dirname.svg?branch=master)](https://travis-ci.org/es128/path-dirname)
  2. > Node.js [`path.dirname()`](https://nodejs.org/api/path.html#path_path_dirname_path) [ponyfill](https://ponyfill.com)
  3. This was needed in order to expose `path.posix.dirname()` on Node.js v0.10
  4. ## Install
  5. ```
  6. $ npm install --save path-dirname
  7. ```
  8. ## Usage
  9. ```js
  10. const pathDirname = require('path-dirname');
  11. pathDirname('/home/foo');
  12. //=> '/home'
  13. pathDirname('C:\\Users\\foo');
  14. //=> 'C:\\Users'
  15. pathDirname('foo');
  16. //=> '.'
  17. pathDirname('foo/bar');
  18. //=> 'foo'
  19. //Using posix version for consistent output when dealing with glob escape chars
  20. pathDirname.win32('C:\\Users\\foo/\\*bar');
  21. //=> 'C:\\Users\\foo/'
  22. pathDirname.posix('C:\\Users\\foo/\\*bar');
  23. //=> 'C:\\Users\\foo'
  24. ```
  25. ## API
  26. See the [`path.dirname()` docs](https://nodejs.org/api/path.html#path_path_dirname_path).
  27. ### pathDirname(path)
  28. ### pathDirname.posix(path)
  29. POSIX specific version.
  30. ### pathDirname.win32(path)
  31. Windows specific version.
  32. ## License
  33. MIT