2 ms·
Hey everyone, I created a TypeScript schema validation library
- spmaxwell7 2y agoSo most TypeScript/JavaScript schema-validation libraries have all kinds of fancy functions for validating everything you could think of under the sun (objects as well as primitives). Problem for me was I already had all kinds of functions for validating things (regexes for strings, checking if something was a boolean or number etc). The only thing that was making me use a schema validation library was trying to validate object properties. I wanted a library that could enable me to use all my existing validator-functions to validate object properties, so I created jet-schema: LINK: https://github.com/seanpmaxwell/jet-schema https://github.com/seanpmaxwell/jet-schema With jet-schema, you setup an object schema like you would other validation libraries, but then you can just pass your existing validator-functions directly to each object property. Jet-schema has features to allow you to set default values and custom error messages for whenever a schema validation fails.