[Pkg-javascript-commits] [node-parents] 09/29: fix for root test

Bastien Roucariès rouca at moszumanska.debian.org
Sun Aug 20 13:47:04 UTC 2017


This is an automated email from the git hooks/post-receive script.

rouca pushed a commit to branch master
in repository node-parents.

commit 1825fd7fc4b965427e94bb9869784845ba1db125
Author: James Halliday <mail at substack.net>
Date:   Thu Jul 12 01:53:47 2012 -0700

    fix for root test
---
 index.js | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/index.js b/index.js
index 072eb41..f07a220 100644
--- a/index.js
+++ b/index.js
@@ -16,7 +16,7 @@ module.exports = function (cwd, opts) {
         return path.normalize(ps.join(isWindows ? '\\' : '/'));
     };
     
-    return path.normalize(cwd)
+    var res = path.normalize(cwd)
         .split(sep)
         .reduce(function (acc,dir,ix) {
             return acc.concat(join(acc[ix], dir))
@@ -24,4 +24,6 @@ module.exports = function (cwd, opts) {
         .slice(1)
         .reverse()
     ;
+    if (res[0] === '/') return ['/'];
+    return res;
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-javascript/node-parents.git



More information about the Pkg-javascript-commits mailing list