(ms)
| 83 | if (unit === "ms") return amount |
| 84 | if (unit.startsWith("s")) return amount * 1000 |
| 85 | if (unit.startsWith("m")) return amount * 60_000 |
| 86 | if (unit.startsWith("h")) return amount * 3_600_000 |
| 87 | if (unit.startsWith("d")) return amount * 86_400_000 |
| 88 | return null |
| 89 | } |
| 90 | |
| 91 | function durationToText(ms) { |
| 92 | if (ms === 0) return "every idle" |
| 93 | if (!Number.isFinite(ms)) return "unknown" |
| 94 | if (ms % 86_400_000 === 0) return `${ms / 86_400_000}d` |
| 95 | if (ms % 3_600_000 === 0) return `${ms / 3_600_000}h` |
| 96 | if (ms % 60_000 === 0) return `${ms / 60_000}m` |
no outgoing calls
no test coverage detected