@zcorky/schema
v1.0.11
Published
Object schema validation written with TypeScript, inspired by dayjs and schema
Downloads
91
Maintainers
Readme
schema
Object schema description language and validator for JavaScript objects, inspired by hapijs/joi and hh54188/schemaor. It is written fully with Typescript.
- 🕒 Familiar
joiAPI & patterns - 💪 Node and Browser Support
- 🔥 Chainable
- :sparkle: TypeScript
- 🌐 I18n support (WIP)
- 🔌 Plugin System (WIP)
Install
$ npm install @zcorky/schemaUsage
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,
});API
- See the detailed API Reference.
Relatived
- joi - Object schema description language and validator for JavaScript objects..
- schemaor
- ajv -The fastest JSON Schema validator for Node.js and browser.
License
MIT © Moeover
