path: isAbsolute() should always return boolean
On Windows, path.isAbsolute() returns an empty string on failed cases. This forces the return value to always be boolean. Reviewed-by: Trevor Norris <trev.norris@gmail.com>
This commit is contained in:
parent
962e651476
commit
20229d6896
@ -206,7 +206,7 @@ if (isWindows) {
|
|||||||
exports.isAbsolute = function(path) {
|
exports.isAbsolute = function(path) {
|
||||||
var result = splitDeviceRe.exec(path),
|
var result = splitDeviceRe.exec(path),
|
||||||
device = result[1] || '',
|
device = result[1] || '',
|
||||||
isUnc = device && device.charAt(1) !== ':';
|
isUnc = !!device && device.charAt(1) !== ':';
|
||||||
// UNC paths are always absolute
|
// UNC paths are always absolute
|
||||||
return !!result[2] || isUnc;
|
return !!result[2] || isUnc;
|
||||||
};
|
};
|
||||||
|
Loading…
x
Reference in New Issue
Block a user