2.6.3 • Published 9 years ago

obj-validation v2.6.3

Weekly downloads
1
License
ISC
Repository
-
Last release
9 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

9 years ago

2.6.2

9 years ago

2.6.1

9 years ago

2.6.0

9 years ago

2.5.7

9 years ago

2.5.6

9 years ago

2.5.5

10 years ago

2.5.4

10 years ago

2.5.3

10 years ago

2.5.2

10 years ago

2.5.1

10 years ago

2.5.0

10 years ago

2.4.10

10 years ago

2.4.9

10 years ago