validator/index.js
Jay 46b19757bd
All checks were successful
continuous-integration/drone/push Build is passing
[feat] add string type pattern check, add object child check
2020-06-10 13:32:50 +00:00

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