0.1.2 • Published 7 years ago

validator-schema v0.1.2

Weekly downloads
1
License
MIT
Repository
-
Last release
7 years ago

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.

0.1.2

7 years ago

0.1.1

7 years ago

0.1.0

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago