From 20229d6896ce4b802a0789b1d2643dcac55bebb9 Mon Sep 17 00:00:00 2001 From: Herman Lee Date: Mon, 4 Aug 2014 22:18:54 +0800 Subject: [PATCH] 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 --- lib/path.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/path.js b/lib/path.js index 04187aaf2f4..44ef0d68e25 100644 --- a/lib/path.js +++ b/lib/path.js @@ -206,7 +206,7 @@ if (isWindows) { exports.isAbsolute = function(path) { var result = splitDeviceRe.exec(path), device = result[1] || '', - isUnc = device && device.charAt(1) !== ':'; + isUnc = !!device && device.charAt(1) !== ':'; // UNC paths are always absolute return !!result[2] || isUnc; };