type-validate

0.0.1 • Public • Published

Type-validate

Check an object against predefined schema.

Example

Sample typings definition:

{
  name: 'string',
  age: 'number',
  height: 'number?',
  isDeveloper: 'boolean',
  birthDate: 'date|number',
  address: {
    country: 'string?',
    city: 'string',
  },
  posts: [{
    title: 'string'
  }, true],

}

It supports:

  • primitive types - string, number, boolean, date, and undefined
  • optional types, defined with ?
  • union types, defined with |
  • array types, defined as [arrayItemType, canArrayBeUndefined]

Readme

Keywords

none

Package Sidebar

Install

npm i type-validate

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

7.8 kB

Total Files

14

Last publish

Collaborators

  • koss-lebedev