swap details and format

This commit is contained in:
nikk gitanes
2021-06-16 04:50:52 +03:00
parent 78d7b64149
commit 1736f8a2d0
2 changed files with 8 additions and 8 deletions

View File

@@ -1,7 +1,7 @@
export function humanizeSize(size) {
if (!size) return ''
const i = Math.floor(Math.log(size) / Math.log(1024))
return `${(size / Math.pow(1024, i)).toFixed(2) * 1} ${['B', 'kB', 'MB', 'GB', 'TB'][i]}`
return `${(size / Math.pow(1024, i)).toFixed(2) * 1} ${['B', 'KB', 'MB', 'GB', 'TB'][i]}`
}
export function getPeerString(torrent) {
@@ -10,4 +10,4 @@ export function getPeerString(torrent) {
}
export const shortenText = (text, sympolAmount) =>
text ? text.slice(0, sympolAmount) + (text.length > sympolAmount ? '...' : '') : ''
text ? text.slice(0, sympolAmount) + (text.length > sympolAmount ? '' : '') : ''