2.6.3 • Published 8 years ago

obj-validation v2.6.3

Weekly downloads
1
License
ISC
Repository
-
Last release
8 years ago

obj-validation

Document

Visit document

Usage

var ObjValidation = require('obj-validation')

var rules = {
    name: {
        type: String,
        length:  8
    },
    age: {
        type: Number,
        max: 150
    }
}

var obj = {
    name: 'hal.zhong',
    age: 10000
}

var validator = new ObjValidation(rules, obj)

if(!validator.validate()){
    var errors = validator.getErrors()
    errors.forEach(function(msg){
        console.error(msg)
    })
    // =>
    // should at least 8 characters
    // should less than or equal to 150
}

Development

install global tools

npm install rollup mocha -g

install npm for development

npm install

build

npm run build

run a auto build service

npm run dev

run test

npm test

2.6.3

8 years ago

2.6.2

8 years ago

2.6.1

8 years ago

2.6.0

8 years ago

2.5.7

8 years ago

2.5.6

8 years ago

2.5.5

8 years ago

2.5.4

8 years ago

2.5.3

8 years ago

2.5.2

8 years ago

2.5.1

8 years ago

2.5.0

8 years ago

2.4.10

8 years ago

2.4.9

8 years ago