(self: DurationInput)
| 383 | * @category getters |
| 384 | */ |
| 385 | export const unsafeToNanos = (self: DurationInput): bigint => { |
| 386 | const _self = decode(self) |
| 387 | switch (_self.value._tag) { |
| 388 | case "Infinity": |
| 389 | throw new Error("Cannot convert infinite duration to nanos") |
| 390 | case "Nanos": |
| 391 | return _self.value.nanos |
| 392 | case "Millis": |
| 393 | return BigInt(Math.round(_self.value.millis * 1_000_000)) |
| 394 | } |
| 395 | } |
| 396 | |
| 397 | /** |
| 398 | * @since 2.0.0 |