19 lines
591 B
JavaScript
19 lines
591 B
JavaScript
const types = require('./types/index.js')
|
|
const validate = require('./validate.js')
|
|
const validator = {}
|
|
module.exports = validator
|
|
|
|
validator.Base = types.Base
|
|
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)
|
|
|
|
/**
|
|
* validate
|
|
* @param {Object} src
|
|
* @param {import('./type.js').Schema} schema
|
|
*/
|
|
validator.validate = validate
|