Ever felt like there wasn't enough validation in your life? Well, now there is!
Just Enough Schemas is a simple, lightweight, and easy-to-use schema validation library for TypeScript. It's designed to be simple to use, but powerful enough to handle most validation needs.
- Simple and Complex Schemas: Define simple schemas with a single line, or complex schemas with nested objects and arrays.
- TypeScript Support: Built using TypeScript and for TypeScript, Just Enough Schemas provides full type support.
- Errors as Values: Schemas does not throw any errors! Instead, they return special objects that will contain type of error.
- Custom Schema Types: Extended Schemas allow you to personalize your schemas with custom types.
npm install just-enough-schemas
import { Schema, ExtendedSchema } from 'just-enough-schemas';
const schema = new Schema({
name: 'string',
age: 'number',
});
const valid = schema.check({
name: 'John Doe',
age: 42,
}); // sucessful validation
For detailed overview of API, please refer to the repo wiki.
Contributions are welcome! If you have a feature request or bug report, please open an issue.
But, I doubt I will fix it myself...