MCPcopy Create free account
hub / github.com/Effect-TS/effect / fromNumber

Function fromNumber

packages/effect/src/BigInt.ts:889–899  ·  view source on GitHub ↗
(n: number)

Source from the content-addressed store, hash-verified

887 * @since 2.4.12
888 */
889export 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.

Callers

nothing calls this directly

Calls 2

someMethod · 0.80
BigIntInterface · 0.70

Tested by

no test coverage detected