From 154138816556d0fd2ef76611c101cad8424e269c Mon Sep 17 00:00:00 2001 From: azu Date: Mon, 19 Jan 2015 15:41:15 +0900 Subject: [PATCH] refactor: remove existsSync ` existsSync` check. --- lib/get-package-json.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/get-package-json.js b/lib/get-package-json.js index 8b63338..c619635 100644 --- a/lib/get-package-json.js +++ b/lib/get-package-json.js @@ -12,14 +12,16 @@ function findPackageDir(paths) { for (var i = 0; i < paths.length; ++i) { var dir = pather.dirname(paths[i]); var dirName = dir.split(pather.sep).pop(); - if (dirName !== packageName && fs.existsSync(pather.join(dir, 'package.json'))) { + if (dirName !== packageName) { return dir; } } } /** + * find package.json directory and return package json. + * You should pass `module.paths` to `paths`. * @param {string[]} paths the paths for look-up - * @returns {*} + * @returns {object} */ function getPackageJSON(paths) { var dir = findPackageDir(paths);