Skip to content

Commit 045f629

Browse files
authoredMay 14, 2020
refactor: code (#471)
1 parent 20c9ae5 commit 045f629

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed
 

‎src/preProcessPattern.js

+13-14
Original file line numberDiff line numberDiff line change
@@ -55,24 +55,23 @@ export default async function preProcessPattern(globalRef, pattern) {
5555
`getting stats for '${pattern.absoluteFrom}' to determinate 'fromType'`
5656
);
5757

58+
let stats;
59+
5860
try {
59-
const stats = await stat(inputFileSystem, pattern.absoluteFrom);
60-
61-
if (!stats) {
62-
return pattern;
63-
}
64-
65-
if (stats.isDirectory()) {
66-
pattern.fromType = 'dir';
67-
} else if (stats.isFile()) {
68-
pattern.fromType = 'file';
69-
pattern.stats = stats;
70-
} else if (!pattern.fromType) {
71-
logger.warn(`unrecognized file type for ${pattern.from}`);
72-
}
61+
stats = await stat(inputFileSystem, pattern.absoluteFrom);
7362
} catch (error) {
7463
return pattern;
7564
}
7665

66+
if (stats.isDirectory()) {
67+
pattern.fromType = 'dir';
68+
return pattern;
69+
}
70+
71+
if (stats.isFile()) {
72+
pattern.fromType = 'file';
73+
pattern.stats = stats;
74+
}
75+
7776
return pattern;
7877
}

0 commit comments

Comments
 (0)
Please sign in to comment.