Skip to content

Commit 1541388

Browse files
committed
refactor: remove existsSync existsSync check.
1 parent 14b9436 commit 1541388

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

lib/get-package-json.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,14 +12,16 @@ function findPackageDir(paths) {
1212
for (var i = 0; i < paths.length; ++i) {
1313
var dir = pather.dirname(paths[i]);
1414
var dirName = dir.split(pather.sep).pop();
15-
if (dirName !== packageName && fs.existsSync(pather.join(dir, 'package.json'))) {
15+
if (dirName !== packageName) {
1616
return dir;
1717
}
1818
}
1919
}
2020
/**
21+
* find package.json directory and return package json.
22+
* You should pass `module.paths` to `paths`.
2123
* @param {string[]} paths the paths for look-up
22-
* @returns {*}
24+
* @returns {object}
2325
*/
2426
function getPackageJSON(paths) {
2527
var dir = findPackageDir(paths);

0 commit comments

Comments
 (0)