.verb.md
July 13, 2017 ยท View on GitHub
Usage
var isUncPath = require('{%= name %}');
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');
- The computer name is always preceded by a double backward-slash (
\\). - UNC paths cannot contain a drive letter (such as
D:)
Release history
v1.0.0 - 2017-07-12
Changes
- now throws a
TypeErrorif value is not a string