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

Class BigDecimal

packages/effect/src/Schema.ts:7928–7941  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

7926 * @since 3.10.0
7927 */
7928export class BigDecimal extends transformOrFail(
7929 String$.annotations({ description: "a string to be decoded into a BigDecimal" }),
7930 BigDecimalFromSelf,
7931 {
7932 strict: true,
7933 decode: (i, _, ast) =>
7934 bigDecimal_.fromString(i).pipe(option_.match({
7935 onNone: () =>
7936 ParseResult.fail(new ParseResult.Type(ast, i, `Unable to decode ${JSON.stringify(i)} into a BigDecimal`)),
7937 onSome: (val) => ParseResult.succeed(bigDecimal_.normalize(val))
7938 })),
7939 encode: (a) => ParseResult.succeed(bigDecimal_.format(bigDecimal_.normalize(a)))
7940 }
7941).annotations({ identifier: "BigDecimal" }) {}
7942
7943/**
7944 * A schema that transforms a `number` into a `BigDecimal`.

Callers

nothing calls this directly

Calls 5

transformOrFailInterface · 0.85
fromStringMethod · 0.80
annotationsMethod · 0.65
pipeMethod · 0.65
failMethod · 0.65

Tested by

no test coverage detected