1.0.0 • Published 9 years ago

dirname-regex v1.0.0

Weekly downloads
10
License
MIT
Repository
github
Last release
9 years ago

dirname-regex NPM version

Regular expression for matching the directory part of a file path.

Install with npm

npm i dirname-regex --save

Usage

var dirnameRe = require('dirname-regex');
var match = 'a/b/c/d.md'.match(dirnameRe());

match[0];
//=> 'a/b/c/d.md'

match[1];
//=> 'a/b/c/'

match[2];
//=> 'a/b/c'

See the tests for more use cases and expected results.

Run tests

Install dev dependencies:

node i -d && mocha

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue

Author

Jon Schlinkert

License

Copyright (c) 2014-2015 Jon Schlinkert
Released under the MIT license


This file was generated by verb on January 12, 2015.