Replies: 1 comment
-
Hey 👋 I'm not sure what the best way to solve this challenge, since there are only numbers and bigints in JavaScript. One solution might be to use import * as v from 'valibot';
const Schema1 = v.pipe(
v.number(),
v.transform((i) => Number(i.toFixed(5))),
);
const Schema2 = v.pipe(
v.number(),
v.check(
(i) => Number(i.toFixed(5)) === i,
'Up to 5 fraction digits are allowed',
),
); |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I would like to have numeric action that applies to number schema
Numeric as in sql numeric example :
numeric(10,5)
valid: 12345.12000/12345.12/1.12345
invalid: 12345.123456/123456.12345
I am not sure how to handle percision errors though
Beta Was this translation helpful? Give feedback.
All reactions