(n: number)
| 887 | * @since 2.4.12 |
| 888 | */ |
| 889 | export function fromNumber(n: number): Option.Option<bigint> { |
| 890 | if (n > Number.MAX_SAFE_INTEGER || n < Number.MIN_SAFE_INTEGER) { |
| 891 | return Option.none() |
| 892 | } |
| 893 | |
| 894 | try { |
| 895 | return Option.some(BigInt(n)) |
| 896 | } catch { |
| 897 | return Option.none() |
| 898 | } |
| 899 | } |
| 900 | |
| 901 | /** |
| 902 | * Returns the JavaScript remainder of dividing one `bigint` by another. |