Fix some small errors

This commit is contained in:
crandmck 2014-03-13 16:26:29 -07:00
parent 4c8682b1c2
commit aa11aad298
1 changed files with 5 additions and 10 deletions

View File

@ -37,7 +37,6 @@ function Validatable() {
* Post.validatesPresenceOf('title', {message: 'Cannot be blank'});
* ```
*
* @param
*/
Validatable.validatesPresenceOf = getConfigurator('presence');
@ -62,10 +61,6 @@ Validatable.validatesPresenceOf = getConfigurator('presence');
* User.validatesLengthOf('password', {min: 7, message: {min: 'too weak'}});
* User.validatesLengthOf('state', {is: 2, message: {is: 'is not valid state name'}});
* ```
*
* @sync
* @nocode
* @see helper/validateLength
*/
Validatable.validatesLengthOf = getConfigurator('length');
@ -157,7 +152,7 @@ Validatable.validate = getConfigurator('custom');
* Default error message: is invalid
*
* Example:
*
*```js
* User.validateAsync('name', customValidator, {message: 'Bad name'});
* function customValidator(err, done) {
* process.nextTick(function () {
@ -175,7 +170,7 @@ Validatable.validate = getConfigurator('custom');
* user.isValid(function (isValid) {
* isValid; // false
* })
*
*```
* @async
* @nocode
* @see helper/validateCustom
@ -325,8 +320,7 @@ function getConfigurator(name, opts) {
* @warning This method can be called as sync only when no async validation
* configured. It's strongly recommended to run all validations as asyncronous.
*
* @param {Function} callback called with (valid)
* @return {Boolean} true if no async validation configured and all passed
* Returns true if no async validation configured and all passed
*
* Example: ExpressJS controller: render user if valid, show flash otherwise
* ```
@ -335,6 +329,7 @@ function getConfigurator(name, opts) {
* else res.flash('error', 'User is not valid'), console.log(user.errors), res.redirect('/users');
* });
* ```
* @param {Function} callback called with (valid)
*/
Validatable.prototype.isValid = function (callback, data) {
var valid = true, inst = this, wait = 0, async = false;
@ -531,7 +526,7 @@ function nullCheck(attr, conf, err) {
* otherwise returns false
*
* @param {Mix} v
* @returns {Boolean} whether `v` blank or not
* Returns true if `v` is blank.
*/
function blank(v) {
if (typeof v === 'undefined') return true;