path-root-regex
Advanced tools
Comparing version 0.1.0 to 0.1.1
@@ -11,3 +11,4 @@ /*! | ||
module.exports = function() { | ||
// Regex is modified from the split device regex in the node.js path module. | ||
return /^([a-zA-Z]:|[\\\/]{2}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?/; | ||
}; |
{ | ||
"name": "path-root-regex", | ||
"description": "Regular expression for getting the root of a posix or windows filepath.", | ||
"version": "0.1.0", | ||
"homepage": "https://github.com/jonschlinkert/path-root-regex", | ||
"version": "0.1.1", | ||
"homepage": "https://github.com/regexhq/path-root-regex", | ||
"author": "Jon Schlinkert (https://github.com/jonschlinkert)", | ||
"repository": "jonschlinkert/path-root-regex", | ||
"repository": "regexhq/path-root-regex", | ||
"bugs": { | ||
"url": "https://github.com/jonschlinkert/path-root-regex/issues" | ||
"url": "https://github.com/regexhq/path-root-regex/issues" | ||
}, | ||
@@ -25,3 +25,3 @@ "license": "MIT", | ||
"gulp-format-md": "^0.1.7", | ||
"mocha": "*" | ||
"mocha": "^2.4.5" | ||
}, | ||
@@ -43,4 +43,12 @@ "keywords": [ | ||
], | ||
"related": { | ||
"list": [ | ||
"path-root", | ||
"parse-filepath", | ||
"is-absolute" | ||
] | ||
}, | ||
"reflinks": [ | ||
"verb" | ||
"verb", | ||
"path-root" | ||
], | ||
@@ -51,2 +59,2 @@ "lint": { | ||
} | ||
} | ||
} |
@@ -1,2 +0,2 @@ | ||
# path-root-regex [![NPM version](https://img.shields.io/npm/v/path-root-regex.svg?style=flat)](https://www.npmjs.com/package/path-root-regex) [![NPM downloads](https://img.shields.io/npm/dm/path-root-regex.svg?style=flat)](https://npmjs.org/package/path-root-regex) [![Build Status](https://img.shields.io/travis/jonschlinkert/path-root-regex.svg?style=flat)](https://travis-ci.org/jonschlinkert/path-root-regex) | ||
# path-root-regex [![NPM version](https://img.shields.io/npm/v/path-root-regex.svg?style=flat)](https://www.npmjs.com/package/path-root-regex) [![NPM downloads](https://img.shields.io/npm/dm/path-root-regex.svg?style=flat)](https://npmjs.org/package/path-root-regex) [![Build Status](https://img.shields.io/travis/regexhq/path-root-regex.svg?style=flat)](https://travis-ci.org/regexhq/path-root-regex) | ||
@@ -15,3 +15,3 @@ > Regular expression for getting the root of a posix or windows filepath. | ||
The module exposes a function that must be called to get the regex. | ||
The module exposes a function that must be called to get the regex (modified from the split device regex in the node.js path module); | ||
@@ -25,10 +25,12 @@ ```js | ||
```assert.equal(match('\\\\server\\share\\abc'), '\\\\server\\share\\'); | ||
assert.equal(match('\\\\server foo\\some folder\\base-file.js'), '\\\\server foo\\some folder\\'); | ||
assert.equal(match('\\\\?\\UNC\\server\\share'), '\\\\?\\UNC\\'); | ||
assert.equal(match('foo/bar/baz.js'), ''); | ||
assert.equal(match('c:\\foo\\bar\\baz.js'), 'c:\\'); | ||
assert.equal(match('\\\\slslslsl\\admin$\\system32'), '\\\\slslslsl\\admin$\\'); | ||
assert.equal(match('/foo/bar/baz.js'), '/'); | ||
``` | ||
See the [path-root](https://github.com/jonschlinkert/path-root) module for examples. | ||
## Related projects | ||
You might also be interested in these projects: | ||
* [is-absolute](https://www.npmjs.com/package/is-absolute): Polyfill for node.js `path.isAbolute`. Returns true if a file path is absolute. | [homepage](https://github.com/jonschlinkert/is-absolute) | ||
* [parse-filepath](https://www.npmjs.com/package/parse-filepath): Parse a filepath into an object. Falls back on the native node.js `path.parse` method if… [more](https://www.npmjs.com/package/parse-filepath) | [homepage](https://github.com/jonschlinkert/parse-filepath) | ||
* [path-root](https://www.npmjs.com/package/path-root): Get the root of a posix or windows filepath. | [homepage](https://github.com/jonschlinkert/path-root) | ||
## Contributing | ||
@@ -70,3 +72,3 @@ | ||
Copyright © 2016, [Jon Schlinkert](https://github.com/jonschlinkert). | ||
Released under the [MIT license](https://github.com/jonschlinkert/path-root-regex/blob/master/LICENSE). | ||
Released under the [MIT license](https://github.com/regexhq/path-root-regex/blob/master/LICENSE). | ||
@@ -73,0 +75,0 @@ *** |
Trivial Package
Supply chain riskPackages less than 10 lines of code are easily copied into your own project and may not warrant the additional supply chain risk of an external dependency.
Found 1 instance in 1 package
No bug tracker
MaintenancePackage does not have a linked bug tracker in package.json.
Found 1 instance in 1 package
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
5090
11
1
1
74
0