0.0.1 • Published 4 years ago

@tuckerconnelly/validate v0.0.1

Weekly downloads
-
License
MIT
Repository
github
Last release
4 years ago

Early Version

validate

Validates json schemas and outputs json-api error objects.

Usage

npm i @tuckerconnelly/validate
const validate = require('@tuckerconnelly/validate');

try {
  validate(
    {
      properties: {
        title: 'id',
        id: { type: integer }
      }
    },
    { notId: 'A string' }
  )
} catch (err) {
  console.error(err.errors);

  // [
  //   {
  //     title: 'Expected id to be a string.'
  //     source: '/id'
  //   }
  // ]
}

License

MIT