validatorjs
validatorjs copied to clipboard
A data validation library in JavaScript for the browser and Node.js, inspired by Laravel's Validator.
I've code this fix to solve this issue ( #413 ), checking if the value passed is not an Array in the `integer`, `digits` and `numeric` rules. And I've added...
#404 bugfix, when default parameter IE 11 was broken
Hey, We've got a data structure (simplified to this) ```js const data = { name: "owen", address: { line_one: "xxx", line_two: null } } validator = new Validator(data, { "address.line_one":...
Hi, ```javascript const editLocationFields = { fields: [ 'Calle', 'NumExt', 'NumInt', 'Colonia', 'Indicaciones', 'Tipo', 'lat', 'lng' ], labels: { Tipo: 'Tipo de ubicación', NumExt: 'Número Exterior', NumInt: 'Número Interior', Indicaciones:...
How can i detect which rule is not passed? ` ``` for (let field in v.errors.all()) { fields.push({ field, value: data[field], message: v.errors.first(field), rule: 'not passed rule' /// what to...
Sample code : `method: 'numeric', description: 'required_with:method|required_if:method,0'` Validations are not triggered when method value is 0.
``` Validator.register('fail_array', function(value, requirement, attribute) { return false; }, ':attribute Failed'); var fields = {attr: []} var rules = {attr: 'fail_array'} new Validator(fields, rules); ``` This validation will won't fail....
I have an array of boolean. How to validate. var data = { status_array: [true, false, true, false] } var rules = { "status_array": "array|in:true,false", } Please Help How to...
Hey, should a string with whitespaces be numeric? When using [numeric function](https://github.com/skaterdav85/validatorjs/blob/master/src/rules.js#L170-L180) it returns `true` ```js function numeric(val) { var num; num = Number(val); // tries to convert value to...