2020-06-11 15:04:57 +00:00
|
|
|
const TypeBase = require('./types/base.js')
|
|
|
|
const TypeString = require('./types/string.js')
|
|
|
|
const TypeNumber = require('./types/number.js')
|
|
|
|
const TypeBoolean = require('./types/boolean.js')
|
|
|
|
const TypeArray = require('./types/array.js')
|
|
|
|
const TypeObject = require('./types/object.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
|
|
|
|
|
2020-06-11 15:04:57 +00:00
|
|
|
validator.Base = TypeBase
|
|
|
|
validator.string = (...args) => new TypeString(...args)
|
|
|
|
validator.number = (...args) => new TypeNumber(...args)
|
|
|
|
validator.boolean = (...args) => new TypeBoolean(...args)
|
|
|
|
validator.array = (...args) => new TypeArray(...args)
|
|
|
|
validator.object = (...args) => new TypeObject(...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
|