不要怂,就是干,撸起袖子干!

Commit e18aa0a5 by Jan Aagaard Meier

Merge pull request #4076 from gustavpursche/master

[ci skip] 📝 Update documentation: node-validator is validate.js
2 parents abd54c9c 0f84d718
Showing with 3 additions and 4 deletions
......@@ -264,7 +264,7 @@ Model validations, allow you to specify format/content/inheritance valid
Validations are automatically run on `create`, `update` and `save`. You can also call `validate()` to manually validate an instance.
The validations are implemented by [validator][3].
The validations are implemented by [validator.js][3].
```js
var ValidateMe = sequelize.define('Foo', {
......@@ -320,7 +320,7 @@ var ValidateMe = sequelize.define('Foo', {
Note that where multiple arguments need to be passed to the built-in validation functions, the arguments to be passed must be in an array. But if a single array argument is to be passed, for instance an array of acceptable strings for `isIn`, this will be interpreted as multiple string arguments instead of one array argument. To work around this pass a single-length array of arguments, such as `[['one', 'two']]` as shown above.
To use a custom error message instead of that provided by node-validator, use an object instead of the plain value or array of arguments, for example a validator which needs no argument can be given a custom message with
To use a custom error message instead of that provided by validator.js, use an object instead of the plain value or array of arguments, for example a validator which needs no argument can be given a custom message with
```js
isInt: {
......@@ -339,7 +339,7 @@ isIn: {
When using custom validator functions the error message will be whatever message the thrown`Error`object holds.
See [the node-validator project][4]for more details on the built in validation methods.
See [the validator.js project][3] for more details on the built in validation methods.
**Hint: **You can also define a custom function for the logging part. Just pass a function. The first parameter will be the string that is logged.
......@@ -642,6 +642,5 @@ sequelize.define('User', {}, {
[0]: #configuration
[3]: https://github.com/chriso/validator.js
[4]: https://github.com/chriso/node-validator
[5]: /docs/latest/misc#asynchronicity
[6]: https://github.com/petkaantonov/bluebird/blob/master/API.md#spreadfunction-fulfilledhandler--function-rejectedhandler----promise
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!