Skip to content
/ schema Public

Object schema validation written with TypeScript, inspired by dayjs and schema

License

Notifications You must be signed in to change notification settings

zcorky/schema

Repository files navigation

schema

NPM version NPM quality Coverage Status Dependencies Build Status Known Vulnerabilities NPM download license issues

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)

Install

$ npm install @zcorky/schema

Usage

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

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

About

Object schema validation written with TypeScript, inspired by dayjs and schema

Resources

License

Stars

Watchers

Forks

Packages

No packages published