Miss any of our Open RFC calls?Watch the recordings here! »

validator-schema

0.1.2 • Public • Published

validator-schema

Install (already includes TypeScript definition file).

npm i -S validator-schema

Schema validation example

import validator, { Schema } from 'validator-schema';
 
const schema: Schema = {
  name: {
    type: 'string',
    test: /goku/i,
    fn: v => v && v.length > 0,
  },
};
 
const validate = validator(schema);
 
const user = {
  name: 'Goku',
};
 
validate(user); // { valid: true, errors: [] }

See tests for more examples.

Keywords

none

Install

npm i validator-schema

DownloadsWeekly Downloads

5

Version

0.1.2

License

MIT

Last publish

Collaborators

  • avatar