switch to prettier-bytes
This commit is contained in:
@@ -21,7 +21,7 @@
|
|||||||
"hyperx": "^2.0.2",
|
"hyperx": "^2.0.2",
|
||||||
"main-loop": "^3.2.0",
|
"main-loop": "^3.2.0",
|
||||||
"network-address": "^1.1.0",
|
"network-address": "^1.1.0",
|
||||||
"pretty-bytes": "^3.0.0",
|
"prettier-bytes": "^1.0.1",
|
||||||
"upload-element": "^1.0.1",
|
"upload-element": "^1.0.1",
|
||||||
"virtual-dom": "^2.1.1",
|
"virtual-dom": "^2.1.1",
|
||||||
"webtorrent": "^0.82.1",
|
"webtorrent": "^0.82.1",
|
||||||
|
|||||||
@@ -3,16 +3,7 @@ module.exports = TorrentList
|
|||||||
var h = require('virtual-dom/h')
|
var h = require('virtual-dom/h')
|
||||||
var hyperx = require('hyperx')
|
var hyperx = require('hyperx')
|
||||||
var hx = hyperx(h)
|
var hx = hyperx(h)
|
||||||
var pb = require('pretty-bytes')
|
var prettyBytes = require('prettier-bytes')
|
||||||
|
|
||||||
function prettyBytes (b) {
|
|
||||||
var pretty = pb(b)
|
|
||||||
|
|
||||||
var ps = pretty.split(/\.| /)
|
|
||||||
// if there is more than one digit to the left of the decimal, chop off the fractional part.
|
|
||||||
if (ps.length > 2 && ps[0].replace('-', '').length > 1) return ps[0] + ' ' + ps[2]
|
|
||||||
return pretty
|
|
||||||
}
|
|
||||||
|
|
||||||
function TorrentList (state, dispatch) {
|
function TorrentList (state, dispatch) {
|
||||||
var list = state.client.torrents.map((torrent) => renderTorrent(torrent, dispatch))
|
var list = state.client.torrents.map((torrent) => renderTorrent(torrent, dispatch))
|
||||||
|
|||||||
Reference in New Issue
Block a user