(m: string)
| 10 | } |
| 11 | |
| 12 | const MetricMult = (m: string): number => { |
| 13 | return Math.pow(1000, [ |
| 14 | SizeToByteMetric.BYTE, |
| 15 | SizeToByteMetric.KB, |
| 16 | SizeToByteMetric.MB, |
| 17 | SizeToByteMetric.GB, |
| 18 | SizeToByteMetric.TB].findIndex(x => x === m)); |
| 19 | }; |
| 20 | |
| 21 | return Math.ceil(size.endsWith('bit') ? |
| 22 | Number.parseFloat(size) * MetricMult(size[size.length - 4]) / 8 : |