From 4741716aaaee6bab9ec8c485b324f27b30357b61 Mon Sep 17 00:00:00 2001 From: jonschlinkert Date: Wed, 26 Oct 2016 06:33:50 -0400 Subject: [PATCH] add checks to ensure `opts.path` is a string --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index 68d01c8..db197ff 100644 --- a/index.js +++ b/index.js @@ -106,14 +106,14 @@ parse.resolve = function resolve(options) { // `git-config-path` determine the path var type = isGlobal ? 'global' : null; var opts = extend({path: configPath(type)}, options); - if (exists(opts.path)) { + if (opts.path && exists(opts.path)) { return opts.path; } - if (opts.cwd) { - opts.path = path.resolve(opts.cwd, opts.path); + if (opts.cwd && opts.path) { + return path.resolve(opts.cwd, opts.path); } - return path.resolve(opts.path); + return opts.path && path.resolve(opts.path); }; /**