Valibot: featherweight validator

giuliano1993

Giuliano1993

Posted on June 24, 2024

Valibot: featherweight validator

Good morning everyone and happy MonDEV! β˜•
I hope that with this heat you are running light processes on your PCs, to avoid melting neither you nor your processors! πŸ˜‚

Today I want to talk about a tool that makes lightness its cornerstone.
It's called Valibot.
Valibot is an npm package for data validation.
It works independently with JS and TypeScript and allows a wide variety of validations. In practical terms, as for the methods, it's essentially 1 to 1 with the most commonly used package for the same task, namely Zod.

Talking about the main strength of this library, we can say that the main strength leveraged by this tool is fundamentally its lightness during the build phase. In fact, each validation is contained as a separate method within the main module, allowing us to import only the necessary validations and not the entire package as a whole into our project.

The origin of this library is very interesting, deriving from the author's thesis ( available online ) which is about writing a modular library focusing on size and performance. Inside it, you can find a comparison with various tools that do the same thing and the reasoning that led Fabien Hiller, the developer of the project, to design his library in this way.

I think this approach can be very interesting because it allows for a deeper comparison with the genesis of a project, something that is often missing!

What do you think? Have you ever tried Valibot or are you thinking of reading the thesis that inspired it?

Let me know as always, because I am very curious! Have a great week and as always

Happy Coding 0_1

πŸ’– πŸ’ͺ πŸ™… 🚩
giuliano1993
Giuliano1993

Posted on June 24, 2024

Join Our Newsletter. No Spam, Only the good stuff.

Sign up to receive the latest update from our blog.

Related