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