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

Function bigintToNumber

packages/platform/node-shared/src/NodeFileSystem.ts:38–44  ·  view source on GitHub ↗
(value: bigint, field: string)

Source from the content-addressed store, hash-verified

36 })
37
38const bigintToNumber = (value: bigint, field: string): number => {
39 const number = Number(value)
40 if (!Number.isSafeInteger(number)) {
41 throw new RangeError(`${field} exceeds the safe integer range: ${value}`)
42 }
43 return number
44}
45
46const bigintToNumberOption = (value: bigint | undefined): Option.Option<number> =>
47 Option.flatMap(Option.fromNullishOr(value), BI.toNumber)

Callers 2

positionToNumberFunction · 0.85
makeFileInfoFunction · 0.85

Calls 1

NumberFunction · 0.50

Tested by

no test coverage detected