Skip to content

Commit

Permalink
Still messing with bigdecimal.js
Browse files Browse the repository at this point in the history
  • Loading branch information
mikek-mnx committed May 9, 2024
1 parent 46250b8 commit 84a669a
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions src/string-decimal.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
import type * as z from 'zod';
import { Numeric } from './numeric.js';
import type * as z from "zod";
import { Numeric } from "./numeric.js";
import type {} from "bigdecimal";

export type StringDecimal = z.infer<typeof StringDecimal>;
export const StringDecimal = Numeric.transform((v) => v.toString()).brand('StringDecimal');
export const StringDecimal = Numeric.transform((v) => v.toString()).brand(
"StringDecimal",
);

export type PositiveStringDecimal = z.infer<typeof PositiveStringDecimal>;
export const PositiveStringDecimal = Numeric.refine((v) => v.gte(0), 'invalid_positive_decimal_string')
export const PositiveStringDecimal = Numeric.refine(
(v) => v.gte(0),
"invalid_positive_decimal_string",
)
.transform((v) => v.toString())
.brand('PositiveStringDecimal');
.brand("PositiveStringDecimal");

0 comments on commit 84a669a

Please sign in to comment.