| 7926 | * @since 3.10.0 |
| 7927 | */ |
| 7928 | export 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`. |
nothing calls this directly
no test coverage detected