Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/eftakhairul/smart-model-validator
A validator library where you will set validator rules and send model or array to validate
https://github.com/eftakhairul/smart-model-validator
javascript js npm-package validator
Last synced: about 2 months ago
JSON representation
A validator library where you will set validator rules and send model or array to validate
- Host: GitHub
- URL: https://github.com/eftakhairul/smart-model-validator
- Owner: eftakhairul
- License: apache-2.0
- Created: 2015-11-20T05:32:04.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-02-14T18:01:44.000Z (almost 8 years ago)
- Last Synced: 2024-11-18T15:29:21.794Z (about 2 months ago)
- Topics: javascript, js, npm-package, validator
- Language: JavaScript
- Size: 20.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# smart-model-validator
[![Build Status](https://travis-ci.org/eftakhairul/smart-model-validator.svg?branch=master)](https://travis-ci.org/eftakhairul/smart-model-validator) [![GitHub issues](https://img.shields.io/github/issues/eftakhairul/smart-model-validator.svg)](https://github.com/eftakhairul/smart-model-validator/issues) [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](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