Object schema description language and validator for JavaScript objects, inspired by hapijs/joi and hh54188/schemaor. It is written fully with Typescript.
- 🕒 Familiar
joi
API & patterns - 💪 Node and Browser Support
- 🔥 Chainable
- ❇️ TypeScript
- 🌐 I18n support (WIP)
- 🔌 Plugin System (WIP)
$ npm install @zcorky/schema
import * as Types from '@zcorky/schema';
const user = new Types.object({
id: new Types.string().require(),
nickname: new Types.string().require(),
homepage: new Types.string(),
age: new Types.number(),
active: new Types.boolean(),
});
const validatedData = Types.validate(user, {
id: '1',
nickname: 'whatwewant',
active: true,
});
- See the detailed API Reference.
- joi - Object schema description language and validator for JavaScript objects..
- schemaor
- ajv -The fastest JSON Schema validator for Node.js and browser.
MIT © Moeover