Replies: 1 comment
-
Great idea! Yes, maybe we should add import * as v from 'valibot';
const Schema = v.pipe(
v.record(v.string(), v.number()),
v.check(
(input) => Object.keys(input).length >= 3,
'Please provide at least 3 entries',
),
); |
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've read the docs and I could not find a built in function to check if a record has an exact number of props. Maybe something like
keys(n)
for checking if the record has an exact n number of props andminKeys(n)
,maxKeys(n)
to check if the record has at least or at most that n number of props.I am missing something? If not I will love to hear how to implement those validations.
Thank you!
Beta Was this translation helpful? Give feedback.
All reactions