MCPcopy
hub / github.com/Effect-TS/effect / BigIntFromNumber

Class BigIntFromNumber

packages/effect/src/Schema.ts:5791–5807  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

5789 * @since 3.10.0
5790 */
5791export class BigIntFromNumber extends transformOrFail(
5792 Number$.annotations({ description: "a number to be decoded into a bigint" }),
5793 BigIntFromSelf.pipe(betweenBigInt(BigInt(Number.MIN_SAFE_INTEGER), BigInt(Number.MAX_SAFE_INTEGER))),
5794 {
5795 strict: true,
5796 decode: (i, _, ast) =>
5797 ParseResult.fromOption(
5798 bigInt_.fromNumber(i),
5799 () => new ParseResult.Type(ast, i, `Unable to decode ${i} into a bigint`)
5800 ),
5801 encode: (a, _, ast) =>
5802 ParseResult.fromOption(
5803 bigInt_.toNumber(a),
5804 () => new ParseResult.Type(ast, a, `Unable to encode ${a}n into a number`)
5805 )
5806 }
5807).annotations({ identifier: "BigIntFromNumber" }) {}
5808
5809const redactedArbitrary = <A>(value: LazyArbitrary<A>): LazyArbitrary<redacted_.Redacted<A>> => (fc) =>
5810 value(fc).map(redacted_.make)

Callers

nothing calls this directly

Calls 4

transformOrFailInterface · 0.85
betweenBigIntFunction · 0.85
annotationsMethod · 0.65
pipeMethod · 0.65

Tested by

no test coverage detected