(self: DurationInput)
| 360 | * @category getters |
| 361 | */ |
| 362 | export const toNanos = (self: DurationInput): Option.Option<bigint> => { |
| 363 | const _self = decode(self) |
| 364 | switch (_self.value._tag) { |
| 365 | case "Infinity": |
| 366 | return Option.none() |
| 367 | case "Nanos": |
| 368 | return Option.some(_self.value.nanos) |
| 369 | case "Millis": |
| 370 | return Option.some(BigInt(Math.round(_self.value.millis * 1_000_000))) |
| 371 | } |
| 372 | } |
| 373 | |
| 374 | /** |
| 375 | * Get the duration in nanoseconds as a bigint. |