monthly update
This commit is contained in:
@@ -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
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user