Skip to content

Commit dc42d90

Browse files
abejfehrsindresorhus
andauthoredFeb 9, 2023
Minor performance improvement (#11)
Co-authored-by: Sindre Sorhus <sindresorhus@gmail.com>
1 parent 4a5368c commit dc42d90

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed
 

‎index.js

+7-1
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,13 @@ export function locatePathSync(
6161

6262
for (const path_ of paths) {
6363
try {
64-
const stat = statFunction(path.resolve(cwd, path_));
64+
const stat = statFunction(path.resolve(cwd, path_), {
65+
throwIfNoEntry: false,
66+
});
67+
68+
if (!stat) {
69+
continue;
70+
}
6571

6672
if (matchType(type, stat)) {
6773
return path_;

0 commit comments

Comments
 (0)
Please sign in to comment.