( key: TKey, value: BananaConfig[TKey], )
| 127 | const normalized = raw.trim().toLowerCase(); |
| 128 | if (!normalized) return null; |
| 129 | |
| 130 | const match = normalized.match(/^(\d+(?:\.\d+)?)(b|kb|mb|gb)?$/); |
| 131 | if (!match) return null; |
| 132 | |
| 133 | const value = parseFloat(match[1]); |
| 134 | if (!Number.isFinite(value) || value <= 0) return null; |
| 135 | |
| 136 | const unit = match[2] || "mb"; |
| 137 | const multiplier = |
| 138 | unit === "gb" |
| 139 | ? 1024 * 1024 * 1024 |
no test coverage detected