From cd92674d959dc4721a1914b63aa702dbe9254812 Mon Sep 17 00:00:00 2001 From: jonschlinkert Date: Thu, 8 Dec 2016 10:03:33 -0500 Subject: [PATCH] simplify resolve --- index.js | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/index.js b/index.js index 01f263c..7e2efb3 100644 --- a/index.js +++ b/index.js @@ -92,22 +92,12 @@ parse.sync = function parseSync(options) { */ parse.resolve = function resolve(options) { - var isGlobal = false; - if (options === 'global') { - isGlobal = true; - options = {}; - } - if (typeof options === 'string') { - options = { path: options }; + options = { type: options }; } - - // if "global" isn't explicitly defined, let - // `git-config-path` determine the path - var type = isGlobal ? 'global' : null; - var opts = extend({path: configPath(type)}, options); - var cwd = opts.cwd || process.cwd(); - return path.resolve(cwd, opts.path); + var opts = extend({cwd: process.cwd()}, options); + var fp = opts.path || configPath(opts.type); + return path.resolve(opts.cwd, fp); }; /**