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

Function toNumber

packages/effect/src/BigInt.ts:816–821  ·  view source on GitHub ↗
(b: bigint)

Source from the content-addressed store, hash-verified

814 * @since 2.0.0
815 */
816export 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.

Callers

nothing calls this directly

Calls 3

someMethod · 0.80
BigIntInterface · 0.70
NumberInterface · 0.70

Tested by

no test coverage detected