19 lines
521 B
JavaScript
19 lines
521 B
JavaScript
const types = require('./types/index.js')
|
|
const validate = require('./validate.js')
|
|
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
|
|
*/
|
|
validator.validate = validate
|