Skip to content

Commit

Permalink
fix: return rate in/out as number (#3798)
Browse files Browse the repository at this point in the history
The return type for `rateIn`/`rateOut` should be a number and not an integer.

go-IPFS returns a `float64` which isn't representable in js, but we are not interested in that level of accuracy for this value so just return it as a regular `number` which can be a `float`.

Fixes #3782

BREAKING CHANGE: rateIn/rateOut are returned as numbers
  • Loading branch information
achingbrain authored Aug 10, 2021
1 parent 863daf6 commit 4b551cb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/stats/bw.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ module.exports = configure(api => {
transform: (stats) => ({
totalIn: BigInt(stats.TotalIn),
totalOut: BigInt(stats.TotalOut),
rateIn: BigInt(stats.RateIn),
rateOut: BigInt(stats.RateOut)
rateIn: parseFloat(stats.RateIn),
rateOut: parseFloat(stats.RateOut)
})
})

Expand Down

0 comments on commit 4b551cb

Please sign in to comment.