Skip to content

Commit 03daca9

Browse files
jamesgeorge007sindresorhus
authored andcommitted
Minor code refactor (#397)
1 parent d09f87c commit 03daca9

File tree

1 file changed

+2
-5
lines changed

1 file changed

+2
-5
lines changed

lib/open-report.js

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,6 @@ const files = (report, predicate) => report.results
3838
.map(result => resultToFile(result));
3939

4040
module.exports = report => {
41-
if (report.errorCount > 0) {
42-
openEditor(files(report, result => result.errorCount > 0));
43-
} else if (report.warningCount > 0) {
44-
openEditor(files(report, result => result.warningCount > 0));
45-
}
41+
const count = report.errorCount > 0 ? 'errorCount' : 'warningCount';
42+
openEditor(files(report, result => result[count] > 0));
4643
};

0 commit comments

Comments
 (0)