@tuckerconnelly/validate

0.0.1 • Public • Published

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

Readme

Keywords

none

Package Sidebar

Install

npm i @tuckerconnelly/validate

Weekly Downloads

0

Version

0.0.1

License

MIT

Unpacked Size

6.52 kB

Total Files

5

Last publish

Collaborators

  • tuckerconnelly