From 0a68f2d0ebd1a7e40655586e393a2d92af6d1dc6 Mon Sep 17 00:00:00 2001 From: michael Date: Tue, 10 Apr 2018 17:03:14 -0400 Subject: [PATCH 1/2] checking if path is absolute --- lib/utils.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index 5d81148..9fdd0b5 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -16,7 +16,12 @@ exports.loadFiles = function(dir, pattern) { dir = !Array.isArray(dir) ? [dir] : dir; for (var i in dir) { - files = files.concat(glob.sync(path.join(process.cwd(), dir[i], pattern))); + var filePath = [process.cwd(), dir[i], pattern]; + if(path.isAbsolute(dir[i])) { + filePath.shift(); + } + + files = files.concat(glob.sync(path.join(...filePath))); } return files; From 1cde47eafa068cc6bdf560500b3c390121aa48c2 Mon Sep 17 00:00:00 2001 From: michael Date: Thu, 3 May 2018 16:49:45 -0400 Subject: [PATCH 2/2] using apply instead of spread operator for join --- lib/utils.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/utils.js b/lib/utils.js index 9fdd0b5..f4a20dd 100644 --- a/lib/utils.js +++ b/lib/utils.js @@ -21,7 +21,7 @@ exports.loadFiles = function(dir, pattern) { filePath.shift(); } - files = files.concat(glob.sync(path.join(...filePath))); + files = files.concat(glob.sync(path.join.apply(null, filePath))); } return files;