Skip to content

Commit

Permalink
refactor: remove existsSync existsSync check.
Browse files Browse the repository at this point in the history
  • Loading branch information
azu committed Jan 19, 2015
1 parent 14b9436 commit 1541388
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/get-package-json.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1541388

Please sign in to comment.