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