Browse Source

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>
archived-io.js-v0.10
Herman Lee 11 years ago
committed by Trevor Norris
parent
commit
20229d6896
  1. 2
      lib/path.js

2
lib/path.js

@ -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…
Cancel
Save