-
-
Notifications
You must be signed in to change notification settings - Fork 217
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: hash validation #307
feat: hash validation #307
Conversation
|
Name | Link |
---|---|
🔨 Latest commit | 259030e |
I think for Valibot it might be better to change the argument to an array to be able to allow different hash types. What do you think? // Just one hash type
hash(['md5']);
// Multiple hash types
hash(['md5', 'sha1', 'crc32']); |
Do you have use case for multiple hash types? |
I don't have this use case in my own projects, but I believe there could be, for example, APIs that accept more than two hash types as a parameter. We could also accept both, a string or an array as the first argument. // With string arg (slower and more complicated)
const Schema1 = union([string([hash('md5')]), string([hash('sha1')])]);
// With array arg (faster and easier to write)
const Schema2 = string([hash(['md5', 'sha1'])]); |
Good example, will add support for array of hash types. |
Thanks! I will review it later. |
I can't thank you enough for all the work you put into Valibot! Soon you will be the second top contributor. Feel free to use the project as a reference. |
No description provided.