2020-06-03 15:49:04 +00:00
|
|
|
const types = require('./types/index.js')
|
2020-06-10 13:32:50 +00:00
|
|
|
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
|
2020-06-10 13:32:50 +00:00
|
|
|
* @param {import('./type.js').Schema} schema
|
2020-06-03 15:49:04 +00:00
|
|
|
*/
|
2020-06-10 13:32:50 +00:00
|
|
|
validator.validate = validate
|