Merge pull request #206 from anatoliychakkaev/master
Documentation improvements
This commit is contained in:
commit
d2376a729a
|
@ -134,6 +134,17 @@ Validatable.validatesFormatOf = getConfigurator('format');
|
|||
*
|
||||
* Default error message: is invalid
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* User.validate('name', customValidator, {message: 'Bad name'});
|
||||
* function customValidator(err) {
|
||||
* if (this.name === 'bad') err();
|
||||
* });
|
||||
* var user = new User({name: 'Peter'});
|
||||
* user.isValid(); // true
|
||||
* user.name = 'bad';
|
||||
* user.isValid(); // false
|
||||
*
|
||||
* @nocode
|
||||
* @see helper/validateCustom
|
||||
*/
|
||||
|
@ -144,6 +155,26 @@ Validatable.validate = getConfigurator('custom');
|
|||
*
|
||||
* Default error message: is invalid
|
||||
*
|
||||
* Example:
|
||||
*
|
||||
* User.validateAsync('name', customValidator, {message: 'Bad name'});
|
||||
* function customValidator(err, done) {
|
||||
* process.nextTick(function () {
|
||||
* if (this.name === 'bad') err();
|
||||
* done();
|
||||
* });
|
||||
* });
|
||||
* var user = new User({name: 'Peter'});
|
||||
* user.isValid(); // false (because async validation setup)
|
||||
* user.isValid(function (isValid) {
|
||||
* isValid; // true
|
||||
* })
|
||||
* user.name = 'bad';
|
||||
* user.isValid(); // false
|
||||
* user.isValid(function (isValid) {
|
||||
* isValid; // false
|
||||
* })
|
||||
*
|
||||
* @async
|
||||
* @nocode
|
||||
* @see helper/validateCustom
|
||||
|
|
Loading…
Reference in New Issue