index.js
function isValid (type, value) {
      switch (type) {
        case 'email':
          return validator.isEmail(value);
          break;
        case 'url':
          return validator.isURL(value);
          break;
        case 'domain':
          return validator.isFQDN(value);
          break;
        case 'ip':
          return validator.isIP(value);
          break;
        case 'alpha':
          return validator.isAlpha(value);
          break;
        case 'number':
          return validator.isNumeric(value);
          break;
        case 'alphanumeric':
          return validator.isAlphanumeric(value);
          break;
        case 'base64':
          return validator.isBase64(value);
          break;
        case 'hexadecimal':
          return validator.isHexadecimal(value);
          break;
        case 'hexcolor':
          return validator.isHexColor(value);
          break;
        case 'int':
          return validator.isInt(value);
          break;
        case 'float':
          return validator.isFloat(value);
          break;
        case 'null':
          return validator.isNull(value);
          break;
        case 'uuid':
          return validator.isUUID(value);
          break;
        case 'date':
          return validator.isDate(value);
          break;
        case 'creditcard':
          return validator.isCreditCard(value);
          break;
        case 'isbn':
          return validator.isISBN(value);
          break;
        case 'mobilephone':
          return validator.isMobilePhone(value);
          break;
        case 'json':
          return validator.isJSON(value);
          break;
        case 'ascii':
          return validator.isAscii(value);
          break;
        case 'mongoid':
          return validator.isMongoId(value);
          break;
        default:
          return false;
          break;
      }
    }
function isValid (type, value) {
      switch (type) {
        case 'email':
          return validator.isEmail(value);
          break;
        case 'url':
          return validator.isURL(value);
          break;
        case 'domain':
          return validator.isFQDN(value);
          break;
        case 'ip':
          return validator.isIP(value);
          break;
        case 'alpha':
          return validator.isAlpha(value);
          break;
        case 'number':
          return validator.isNumeric(value);
          break;
        case 'alphanumeric':
          return validator.isAlphanumeric(value);
          break;
        case 'base64':
          return validator.isBase64(value);
          break;
        case 'hexadecimal':
          return validator.isHexadecimal(value);
          break;
        case 'hexcolor':
          return validator.isHexColor(value);
          break;
        case 'int':
          return validator.isInt(value);
          break;
        case 'float':
          return validator.isFloat(value);
          break;
        case 'null':
          return validator.isNull(value);
          break;
        case 'uuid':
          return validator.isUUID(value);
          break;
        case 'date':
          return validator.isDate(value);
          break;
        case 'creditcard':
          return validator.isCreditCard(value);
          break;
        case 'isbn':
          return validator.isISBN(value);
          break;
        case 'mobilephone':
          return validator.isMobilePhone(value);
          break;
        case 'json':
          return validator.isJSON(value);
          break;
        case 'ascii':
          return validator.isAscii(value);
          break;
        case 'mongoid':
          return validator.isMongoId(value);
          break;
        default:
          return false;
          break;
      }
    }
function isValid ( type , value ) { switch ( type ) { case 'email' : return validator . isEmail ( value ) ; break ; case 'url' : return validator . isURL ( value ) ; break ; case 'domain' : return validator . isFQDN ( value ) ; break ; case 'ip' : return validator . isIP ( value ) ; break ; case 'alpha' : return validator . isAlpha ( value ) ; break ; case 'number' : return validator . isNumeric ( value ) ; break ; case 'alphanumeric' : return validator . isAlphanumeric ( value ) ; break ; case 'base64' : return validator . isBase64 ( value ) ; break ; case 'hexadecimal' : return validator . isHexadecimal ( value ) ; break ; case 'hexcolor' : return validator . isHexColor ( value ) ; break ; case 'int' : return validator . isInt ( value ) ; break ; case 'float' : return validator . isFloat ( value ) ; break ; case 'null' : return validator . isNull ( value ) ; break ; case 'uuid' : return validator . isUUID ( value ) ; break ; case 'date' : return validator . isDate ( value ) ; break ; case 'creditcard' : return validator . isCreditCard ( value ) ; break ; case 'isbn' : return validator . isISBN ( value ) ; break ; case 'mobilephone' : return validator . isMobilePhone ( value ) ; break ; case 'json' : return validator . isJSON ( value ) ; break ; case 'ascii' : return validator . isAscii ( value ) ; break ; case 'mongoid' : return validator . isMongoId ( value ) ; break ; default : return false ; break ; } }
call a validator method depending on type
call a validator method depending on type