(value)
| 5 | * @returns {number} |
| 6 | */ |
| 7 | export function parse_as_bytes(value) { |
| 8 | const multiplier = |
| 9 | { |
| 10 | K: 1024, |
| 11 | M: 1024 * 1024, |
| 12 | G: 1024 * 1024 * 1024 |
| 13 | }[value[value.length - 1]?.toUpperCase()] ?? 1; |
| 14 | return Number(multiplier != 1 ? value.substring(0, value.length - 1) : value) * multiplier; |
| 15 | } |
no outgoing calls
no test coverage detected