JSPM

is-unc-path

0.1.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 8608008
  • Score
    100M100P100Q232089F
  • License MIT

Returns true if a filepath is a windows UNC file path.

Package Exports

  • is-unc-path

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (is-unc-path) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

is-unc-path NPM version

Returns true if a filepath is a windows UNC file path.

Install with npm

$ npm i is-unc-path --save

Usage

var isUncPath = require('is-unc-path');

true

Returns true for windows UNC paths:

isUncPath('\\/foo/bar');
isUncPath('\\\\foo/bar');
isUncPath('\\\\foo\\admin$');
isUncPath('\\\\foo\\admin$\\system32');
isUncPath('\\\\foo\\temp');
isUncPath('\\\\/foo/bar');
isUncPath('\\\\\\/foo/bar');

false

Returns false for non-UNC paths:

isUncPath('/foo/bar');
isUncPath('/');
isUncPath('/foo');
isUncPath('/foo/');
isUncPath('c:');
isUncPath('c:.');
isUncPath('c:./');
isUncPath('c:./file');
isUncPath('c:/');
isUncPath('c:/file');

Customization

Use .source to use the regex as a component of another regex:

var myRegex = new RegExp(isUncPath.source + 'foo');

Rules for UNC paths

  • The computer name is always preceded by a double backward-slash (\\).
  • UNC paths cannot contain a drive letter (such as D:)
  • dotfile-regex: Regular expresson for matching dotfiles.
  • dotdir-regex: Regex for matching dot-directories, like .git/
  • dirname-regex: Regular expression for matching the directory part of a file path.
  • is-glob: Returns true if the given string looks like a glob pattern.
  • path-regex: Regular expression for matching the parts of a file path.
  • unc-path-regex: Returns true if a filepath is a windows UNC file path.

Running tests

Install dev dependencies:

$ npm i -d && npm test

Contributing

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

Author

Jon Schlinkert

License

Copyright © 2015 Jon Schlinkert Released under the MIT license.


This file was generated by verb-cli on July 07, 2015.