module: minor performance improvement

PR-URL: https://github.com/nodejs/node/pull/16125
Reviewed-By: Anna Henningsen <anna@addaleax.net>
pull/16201/head
243083df 2017-10-10 19:38:45 +04:00 committed by Anna Henningsen
parent 1a9f48a875
commit 695b307cc6
No known key found for this signature in database
GPG Key ID: 9C63F3A6CD2AD8F9
1 changed files with 3 additions and 8 deletions

View File

@ -218,14 +218,9 @@ Module._findPath = function(request, paths, isMain) {
if (!filename && rc === 1) { // Directory.
if (exts === undefined)
exts = Object.keys(Module._extensions);
filename = tryPackage(basePath, exts, isMain);
}
if (!filename && rc === 1) { // Directory.
// try it with each of the extensions at "index"
if (exts === undefined)
exts = Object.keys(Module._extensions);
filename = tryExtensions(path.resolve(basePath, 'index'), exts, isMain);
filename = tryPackage(basePath, exts, isMain) ||
// try it with each of the extensions at "index"
tryExtensions(path.resolve(basePath, 'index'), exts, isMain);
}
if (filename) {