repocrypts / Validator

Client-side javascript validator library ports from Laravel 5.2
MIT License
46 stars 22 forks source link

digits_between validation not working #10

Closed mafeifan closed 6 years ago

mafeifan commented 6 years ago

version 1.0.5

var Validator = require('Validator')

var data = {
    voteNumber: 33
}
var rules = {
    voteNumber: 'digits_between:1,10'
}

var v = Validator.make(data, rules)
// should run this place
if (v.fails()) {
    var errors = v.getErrors()
    console.log(errors)
}

if (v.passes()) {
    console.log('pass')
}

also I got error TypeError: itemRules.split is not a function when use an array of strings rule

var data = {
    company: 'Example Co.'
}
var rules = {
    company:  ['required', 'string'] // can be an array of strings
}

var v = Validator.make(data, rules)

if (v.fails()) {
    var errors = v.getErrors()
    console.log(errors)
}

image

mafeifan commented 6 years ago

please switch to use https://github.com/skaterdav85/validatorjs