3 ms·
This is a list of common typescript validator functions to shorten your application's boolean logic. It also contains some utility functions for transforming va
by spmaxwell7 2y ago
This is a list of common typescript validator functions to shorten your application's boolean logic. It also contains some utility functions for transforming values before validating them and also validating object schemas. It isn't meant to replace complex schema validation libraries like zod, it just a big list of simple validators.
Link: https://github.com/seanpmaxwell/jet-validators https://github.com/seanpmaxwell/jet-validators
Background:
So under my projects utils/ folder I had a long and growing list of validator functions. It got so big I decided to make a separate repo for it (https://github.com/seanpmaxwell/ts-validators/tree/master https://github.com/seanpmaxwell/ts-validators/tree/master) so I could copy and paste the functions to multiple projects.
Due to positive feedback for the repo on reddit and to avoid having to update multiple projects whenever the logic for a validator-function changed I decided to create a library for my validator functions: