From 324df211d67d4c8b1e3b3d79c9e3e027c023227e Mon Sep 17 00:00:00 2001 From: ron-liu Date: Sun, 16 Feb 2014 22:06:21 +1100 Subject: [PATCH] Update README.md --- README.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 3980e90..52de25a 100644 --- a/README.md +++ b/README.md @@ -106,7 +106,7 @@ v.hasErrors(['a', 'b'], [[v.isString]]) // ==> null ### To validate object ``` javascript v.hasErrors({name: 'john', age: 27}, {name: v.isString, age: v.isNumber}) // ==> null -* v.hasErrors({name: 'john', age: '27'}, {name: v.isString, age: v.isNumber}) // ==> ['it.age is not number'] +v.hasErrors({name: 'john', age: '27'}, {name: v.isString, age: v.isNumber}) // ==> ['it.age is not number'] ``` ### To validate complex object @@ -138,6 +138,7 @@ v.hasErrors( ### To extend, add custom validators * With auto error message + ``` javascript v.register('isGender', function(value) { @@ -147,7 +148,9 @@ v.register('isGender', v.hasErrors('male', v.isGender) // ==> null v.hasErrors('middle', v.isGender) // ==> ['it is invalid'] ``` + * With error message + ``` javascript v.register('isGender', v.build( function(value) {