(b: bigint)
| 814 | * @since 2.0.0 |
| 815 | */ |
| 816 | export const toNumber = (b: bigint): Option.Option<number> => { |
| 817 | if (b > BigInt(Number.MAX_SAFE_INTEGER) || b < BigInt(Number.MIN_SAFE_INTEGER)) { |
| 818 | return Option.none() |
| 819 | } |
| 820 | return Option.some(Number(b)) |
| 821 | } |
| 822 | |
| 823 | /** |
| 824 | * Parses a string into a `bigint` safely. |