@zcorky/schema
Version:
Object schema validation written with TypeScript, inspired by dayjs and schema
60 lines (45 loc) • 2.3 kB
Markdown
# schema
[](https://www.npmjs.com/package/@zcorky/schema)
[](http://packagequality.com/#?package=@zcorky/schema)
[](https://codecov.io/gh/zcorky/schema)
[](https://david-dm.org/zcorky/schema)
[](https://travis-ci.com/zcorky/schema)
[](https://snyk.io/test/npm/@zcorky/schema)
[](https://www.npmjs.com/package/@zcorky/schema)

[](https://github.com/zcorky/schema/issues)
> Object schema description language and validator for JavaScript objects, inspired by [hapijs/joi](https://github.com/hapijs/joi) and [hh54188/schemaor](https://github.com/hh54188/schemaor). It is written fully with Typescript.
* 🕒 Familiar `joi` API & patterns
* 💪 Node and Browser Support
* 🔥 Chainable
* :sparkle: TypeScript
* 🌐 I18n support (WIP)
* 🔌 Plugin System (WIP)
## Install
```
$ npm install @zcorky/schema
```
## Usage
```js
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](./docs).
### Relatived
* [joi]([https://github.com/iamkun/dayjs](https://github.com/hapijs/joi)) - Object schema description language and validator for JavaScript objects..
* [schemaor](https://github.com/hh54188/schemaor)
* [ajv](https://github.com/epoberezkin/ajv) -The fastest JSON Schema validator for Node.js and browser.
## License
MIT © [Moeover](https://moeover.com)