monthly update

This commit is contained in:
2022-01-04 12:55:36 +01:00
parent 29d23144e7
commit aa79d8a0d0
18 changed files with 491 additions and 161 deletions

View File

@@ -13,4 +13,17 @@ export function ellipsis(str: string, lim: number): string {
return str.length > lim ? `${str.substr(0, lim)}...` : str
}
return ''
}
export function detectSpeed(str: string): number {
let effective = str.match(/[\d,]+(\.\d+)?/)[0]
const unit = str.replace(effective, '')
switch (unit) {
case 'MiB/s':
return Number(effective) * 1000
case 'KiB/s':
return Number(effective)
default:
return 0
}
}