TypeScript ready object schema validation
NPM:
npm i @foxify/schemaYarn:
yarn add @foxify/schemaGithub Packages:
npm i @foxifyjs/schemaimport Schema from "@foxify/schema";
const schema = {
username: Schema.string()
.alphanum()
.required(),
name: Schema.object().keys({
first: Schema.string()
.min(3)
.required(),
last: Schema.string().min(3),
}).required(),
datetime: Schema.date().default(Date.now),
};
try {
const result = Schema.object().keys(schema).validate(value);
} catch (error) {
// your error handler
}for more details read the documents
Support this project by becoming a sponsor. Your logo will show up here. [Become a sponsor]
- Ardalan Amini - Core Maintainer - @ardalanamini
See also the list of contributors who participated in this project.
We use SemVer for versioning. For the versions available, see the releases.
This project is licensed under the MIT License - see the LICENSE file for details