We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
int
num
1 parent f8ec907 commit 0c7a488Copy full SHA for 0c7a488
src/schemas.ts
@@ -39,8 +39,8 @@ export const checkboxAsString = v.optional(v.pipe(
39
*/
40
export const intAsString = v.pipe(
41
v.string(),
42
- v.regex(/^-?\d+$/, 'Must be an integer string'),
43
- v.transform(val => Number.parseInt(val, 10)),
+ v.transform(Number),
+ v.integer('Must be an integer string'),
44
)
45
46
/**
@@ -53,6 +53,6 @@ export const intAsString = v.pipe(
53
54
export const numAsString = v.pipe(
55
56
- v.regex(/^-?(?:\d+(?:\.\d+)?|\.\d+)$/, 'Must be a number string'),
+ v.decimal('Must be a number string'),
57
v.transform(Number),
58
0 commit comments