path-dirname
Node.js path.dirname() ponyfill
Last updated 4 years ago by es128 .
MIT · Repository · Bugs · Original npm · Tarball · package.json
$ cnpm install path-dirname 
SYNC missed versions from official npm registry.

path-dirname Build Status

Node.js path.dirname() ponyfill

This was needed in order to expose path.posix.dirname() on Node.js v0.10

Install

$ npm install --save path-dirname

Usage

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'

API

See the path.dirname() docs.

pathDirname(path)

pathDirname.posix(path)

POSIX specific version.

pathDirname.win32(path)

Windows specific version.

License

MIT

Current Tags

  • 1.0.2                                ...           latest (4 years ago)

1 Versions

  • 1.0.2                                ...           4 years ago
Maintainers (2)
Downloads
Today 13,336
This Week 13,336
This Month 272,662
Last Day 8,988
Last Week 158,576
Last Month 646,503
Dependencies (0)
None
Dev Dependencies (0)
None

Copyright 2014 - 2017 © taobao.org |