Last change
on this file since b738035 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago |
initial commit
|
-
Property mode
set to
100644
|
File size:
1.0 KB
|
Line | |
---|
1 | # path-dirname [![Build Status](https://travis-ci.org/es128/path-dirname.svg?branch=master)](https://travis-ci.org/es128/path-dirname)
|
---|
2 |
|
---|
3 | > Node.js [`path.dirname()`](https://nodejs.org/api/path.html#path_path_dirname_path) [ponyfill](https://ponyfill.com)
|
---|
4 |
|
---|
5 | This was needed in order to expose `path.posix.dirname()` on Node.js v0.10
|
---|
6 |
|
---|
7 | ## Install
|
---|
8 |
|
---|
9 | ```
|
---|
10 | $ npm install --save path-dirname
|
---|
11 | ```
|
---|
12 |
|
---|
13 |
|
---|
14 | ## Usage
|
---|
15 |
|
---|
16 | ```js
|
---|
17 | const pathDirname = require('path-dirname');
|
---|
18 |
|
---|
19 | pathDirname('/home/foo');
|
---|
20 | //=> '/home'
|
---|
21 | pathDirname('C:\\Users\\foo');
|
---|
22 | //=> 'C:\\Users'
|
---|
23 | pathDirname('foo');
|
---|
24 | //=> '.'
|
---|
25 | pathDirname('foo/bar');
|
---|
26 | //=> 'foo'
|
---|
27 |
|
---|
28 | //Using posix version for consistent output when dealing with glob escape chars
|
---|
29 | pathDirname.win32('C:\\Users\\foo/\\*bar');
|
---|
30 | //=> 'C:\\Users\\foo/'
|
---|
31 | pathDirname.posix('C:\\Users\\foo/\\*bar');
|
---|
32 | //=> 'C:\\Users\\foo'
|
---|
33 | ```
|
---|
34 |
|
---|
35 |
|
---|
36 | ## API
|
---|
37 |
|
---|
38 | See the [`path.dirname()` docs](https://nodejs.org/api/path.html#path_path_dirname_path).
|
---|
39 |
|
---|
40 | ### pathDirname(path)
|
---|
41 |
|
---|
42 | ### pathDirname.posix(path)
|
---|
43 |
|
---|
44 | POSIX specific version.
|
---|
45 |
|
---|
46 | ### pathDirname.win32(path)
|
---|
47 |
|
---|
48 | Windows specific version.
|
---|
49 |
|
---|
50 |
|
---|
51 | ## License
|
---|
52 |
|
---|
53 | MIT
|
---|
Note:
See
TracBrowser
for help on using the repository browser.