code: function type(rule, value, source, errors, options) {
    if (rule.required && value === undefined) {
      required(rule, value, source, errors, options);
      return;
    }
    const custom = ['integer', 'float', 'array', 'regexp', 'object',
      'method', 'email', 'number', 'date', 'url', 'hex'];
    const ruleType = rule.type;
    if (custom.indexOf(ruleType) > -1) {
      if (!types[ruleType](value)) {
        errors.push(util.format(options.messages.types[ruleType], rule.fullField, rule.type));
      }
      // straight typeof check
    } else if (ruleType && typeof (value) !== rule.type) {
      errors.push(util.format(options.messages.types[ruleType], rule.fullField, rule.type));
    }
  }
docs: Rule for validating the type of a value.
  
  @param rule The validation rule.
  @param value The value of the field on the source object.
  @param source The source object being validated.
  @param errors An array of errors that this rule may add
  validation errors to.
  @param options The validation options.
  @param options.messages The validation messages.