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
|
2020-06-10 14:13:34 +00:00
|
|
|
validator.string = (...args) => new types.StringType(...args)
|
|
|
|
validator.number = (...args) => new types.NumberType(...args)
|
|
|
|
validator.boolean = (...args) => new types.BooleanType(...args)
|
|
|
|
validator.array = (...args) => new types.ArrayType(...args)
|
|
|
|
validator.object = (...args) => new types.ObjectType(...args)
|
2020-06-03 15:49:04 +00:00
|
|
|
|
|
|
|
/**
|
|
|
|
* 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
|