Socket
Socket
Sign inDemoInstall

path-root-regex

Package Overview
Dependencies
0
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 0.1.0 to 0.1.1

1

index.js

@@ -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}[^\\\/]+[\\\/]+[^\\\/]+)?([\\\/])?/;
};

22

package.json
{
"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 @@ ***

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc