## Modules
filter
## Classes
Validator
## Functions
CustomValidateFunction(value, [req])*
## Typedefs
ValidateElement
Schema
## filter * [filter](#module_filter) * [module.exports(option)](#exp_module_filter--module.exports) ⏏ * [~ErrorResponseCallback](#module_filter--module.exports..ErrorResponseCallback) : function ### module.exports(option) ⏏ **Kind**: Exported function | Param | Type | Description | | --- | --- | --- | | option | Object | | | option.basePath | String | The directory of validator schema files to use. | | option.urlPrefix | String | The prefix string of the url path to validate. | | [option.filenameReplaces] | Object | A map of data to indicate which characters to be replaced. | | [option.filenameSuffix] | String | Only the files end with `option.filenameSuffix` will be processed. The default value is `.js` . | | [option.errorResponseCallback] | ErrorResponseCallback | | #### module.exports~ErrorResponseCallback : function **Kind**: inner typedef of [module.exports](#exp_module_filter--module.exports) | Param | Type | | --- | --- | | req | Request | | res | Response | | next | function | | err | String \| Object \| undefined | ## Validator **Kind**: global class * [Validator](#Validator) * [new Validator()](#new_Validator_new) * _instance_ * [.doValidate(params)](#Validator+doValidate) ⇒ null \| Object \| String * _static_ * [.Validator](#Validator.Validator) * [new Validator(schema)](#new_Validator.Validator_new) ### new Validator() The class of Validator ### validator.doValidate(params) ⇒ null \| Object \| String To do a validation. **Kind**: instance method of [Validator](#Validator) | Param | Type | | --- | --- | | params | Object | ### Validator.Validator **Kind**: static class of [Validator](#Validator) #### new Validator(schema) Creates an instance of Validator. | Param | Type | | --- | --- | | schema | [Schema](#Schema) | ## CustomValidateFunction(value, [req]) ⇒ \* **Kind**: global function **Returns**: \* - the validate result, when none error, you can return `false` `undefined` `null` or anything can transform to false, when the value is not suitable, you can return a string or an object. | Param | Type | Description | | --- | --- | --- | | value | \* | the value you want to validated | | [req] | http.IncomingMessage | the req object of express | ## ValidateElement **Kind**: global typedef **Properties** | Name | Type | Description | | --- | --- | --- | | required | Boolean \| Array | indicate whether the current field necessary | | type | Number \| JSON \| Date \| Array | declare the current field's type. | | custom | FuncCustomValidateFunctiontion | the custom validate function | ## Schema **Kind**: global typedef **Properties** | Name | Type | | --- | --- | | filedName | [ValidateElement](#ValidateElement) | **Example** ```javascript { numberFiled : { required:true, type : Number } } ``` **Example** ```javascript { dateField:{ required:[true,'the dateField can not be empty'] type:[Date,'the dataField must be a Date'] } } ```