From 16cc629c591d332e7264e8d2add21fac178b0860 Mon Sep 17 00:00:00 2001 From: Kevin Farrugia Date: Mon, 21 Jun 2021 12:25:43 +0200 Subject: [PATCH] Added fix for cases when _bytesTransferred === 0 --- lib/hara.js | 4 ++-- package.json | 3 --- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/lib/hara.js b/lib/hara.js index ba7c154..faf84fe 100644 --- a/lib/hara.js +++ b/lib/hara.js @@ -38,7 +38,7 @@ const parseLargestCompressed = (data) => { return { url: normalizeUrl(item.request.url), - bytesTransferred: item.response._transferSize || item._bytesIn, + bytesTransferred: item.response._transferSize || item._bytesIn || 0, }; }; @@ -126,7 +126,7 @@ const parseRequests = (data) => { ), }, bytesTransferred: sum( - data.map((n) => n.response._transferSize || n._bytesIn) + data.map((n) => n.response._transferSize || n._bytesIn || 0) ), topUrl: parseTop(data.map((n) => normalizeUrl(n.request.url))), largest: parseLargest(data), diff --git a/package.json b/package.json index b8ec15a..211d0f3 100644 --- a/package.json +++ b/package.json @@ -25,9 +25,6 @@ "git add --force" ] }, - "scripts": { - "start": "node ./lib/main.js" - }, "license": "MIT", "dependencies": { "chalk": "^4.1.1",