async-validator
Advanced tools
Comparing version
@@ -160,3 +160,3 @@ import _extends from 'babel-runtime/helpers/extends'; | ||
if (errors.length) { | ||
warning('async-validator:', errors); | ||
Schema.warning('async-validator:', errors); | ||
} | ||
@@ -261,4 +261,6 @@ if (errors.length && rule.message) { | ||
Schema.warning = warning; | ||
Schema.messages = defaultMessages; | ||
export default Schema; |
# History | ||
---- | ||
## 1.10.1 / 2018-12-18 | ||
- support override warning | ||
## 1.10.0 / 2018-10-17 | ||
@@ -5,0 +9,0 @@ |
@@ -178,3 +178,3 @@ 'use strict'; | ||
if (errors.length) { | ||
(0, _util.warning)('async-validator:', errors); | ||
Schema.warning('async-validator:', errors); | ||
} | ||
@@ -279,2 +279,4 @@ if (errors.length && rule.message) { | ||
Schema.warning = _util.warning; | ||
Schema.messages = _messages2.messages; | ||
@@ -281,0 +283,0 @@ |
{ | ||
"name": "async-validator", | ||
"version": "1.10.0", | ||
"version": "1.10.1", | ||
"description": "validate form asynchronous", | ||
@@ -5,0 +5,0 @@ "keywords": [ |
@@ -64,7 +64,7 @@ # async-validator | ||
* `first`: Boolean, Invoke `callback` when the first validation rule generates an error, | ||
no more validation rules are processed. | ||
* `first`: Boolean, Invoke `callback` when the first validation rule generates an error, | ||
no more validation rules are processed. | ||
If your validation involves multiple asynchronous calls (for example, database queries) and you only need the first error use this option. | ||
* `firstFields`: Boolean|String[], Invoke `callback` when the first validation rule of the specified field generates an error, | ||
* `firstFields`: Boolean|String[], Invoke `callback` when the first validation rule of the specified field generates an error, | ||
no more validation rules of the same field are processed. `true` means all fields. | ||
@@ -200,3 +200,3 @@ | ||
validator.validate({ address: {} }, (errors, fields) => { | ||
// errors for street, address.city, address.zip and address.name | ||
// errors for address.street, address.city, address.zip | ||
}); | ||
@@ -223,3 +223,3 @@ ``` | ||
validator.validate({ address: {} }, (errors, fields) => { | ||
// now only errors for street and name | ||
// now only errors for street | ||
}); | ||
@@ -339,3 +339,3 @@ ``` | ||
}, | ||
promiseField:{ | ||
@@ -352,2 +352,11 @@ validator(rule, value){ | ||
## FAQ | ||
### avoid warning | ||
```js | ||
var Schema = require('async-validator'); | ||
Schema.warning = function(){}; | ||
``` | ||
## Test Case | ||
@@ -354,0 +363,0 @@ |
97820
0.21%2376
0.08%375
2.46%