Skip to content

Commit 812b05e

Browse files
committed
Adds score rounding to avoid floating point errors
1 parent 4cc6912 commit 812b05e

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const formatResults = ({ results, thresholds }) => {
9898
}));
9999

100100
const shortSummary = categories
101-
.map(({ title, score }) => `${title}: ${score * 100}`)
101+
.map(({ title, score }) => `${title}: ${Math.round(score * 100)}`)
102102
.join(', ');
103103

104104
const formattedReport = makeReplacements(results.report);
@@ -226,7 +226,7 @@ const processResults = ({ data, errors }) => {
226226

227227
if (summary) {
228228
obj.summary = summary.reduce((acc, item) => {
229-
acc[item.id] = item.score * 100;
229+
acc[item.id] = Math.round(item.score * 100);
230230
return acc;
231231
}, {});
232232
}

0 commit comments

Comments
 (0)