validator/index.js

19 lines
521 B
JavaScript
Raw Normal View History

2020-06-03 15:49:04 +00:00
const types = require('./types/index.js')
const validate = require('./validate.js')
2020-06-03 15:49:04 +00:00
const validator = {}
module.exports = validator
validator.Base = types.Base
validator.string = () => new types.StringType()
validator.number = () => new types.NumberType()
validator.boolean = () => new types.BooleanType()
validator.array = () => new types.ArrayType()
validator.object = () => new types.ObjectType()
/**
* validate
* @param {Object} src
* @param {import('./type.js').Schema} schema
2020-06-03 15:49:04 +00:00
*/
validator.validate = validate