Skip to content

Commit

Permalink
fix | support value 0 in distribution
Browse files Browse the repository at this point in the history
  • Loading branch information
Tomasz Gospodarczyk committed Apr 20, 2021
1 parent 9e7ccd0 commit a19d1b5
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 5 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
node_modules
5 changes: 2 additions & 3 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "kruk",
"version": "0.1.2",
"version": "0.1.3",
"description": "Command Line Tool for CrUX Rest API",
"repository": "https://github.com/gotomi/kruk",
"main": "index.js",
Expand Down
8 changes: 7 additions & 1 deletion src/crux-convert.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,13 @@ function convertData(data) {
const m = abbr(metric);
if (typeof el.metrics[metric] !== 'undefined') {
const p75value = el.metrics[metric].percentiles.p75;
const histogram = el.metrics[metric].histogram.map(item => Math.round(item.density * 10000) / 100);
const histogram = el.metrics[metric].histogram.map(item => {
if (item.density) {
return Math.round(item.density * 10000) / 100
} else {
return 0
}
});

const rank = metricRank(p75value, metric);
item[m] = {
Expand Down

0 comments on commit a19d1b5

Please sign in to comment.