smart-model-validator
Version:
A validator library where you will set validator rules and send model or array to validate
51 lines (36 loc) • 1.24 kB
Markdown
# smart-model-validator
[](https://travis-ci.org/eftakhairul/node-model-validator) [](https://github.com/eftakhairul/smart-model-validator/issues) [](https://raw.githubusercontent.com/eftakhairul/smart-model-validator/master/LICENSE)
It validate model as object against specific rules. It's has following features
-- Custom error message
-- Accept custom validation
### Version
0.0.5
### Installation
Install package globally:
```sh
$ npm install -g smart-model-validator
```
Or inside project:
```sh
$ npm install smart-model-validator --save
```
## Examples
```js
//require library
var ModelValidator = require('smart-model-validator');
var modelValidator = new ModelValidator();
modelValidator.setRules({name:{require:true, type: 'string'}});
console.log(modelValidator.isValid({name: 'Mr. Smith'})); //true
```
## Supported Validation
- String
- Int
- Base64
- Boolean
- Date
- Float
- IP
- ISBN
- SO8601
- JSON
- UUID