code: function joiErrorsForForms(format, options) {
    var convert = useNothing;
    if (typeof options === 'string') { convert = useFixedMsg; }
    if (typeof options === 'object') {
      convert = isArray(options) ? useJoiMsg : useJoiType;
    }
  
    return function joiErrorsForFormsInner(joiErrs) {
      if (!joiErrs || !joiErrs.details) {
        return null;
      }
  
      var newErrs = {};
      for (var i = 0, leni = joiErrs.details.length; i < leni; i++) {
        var detail = joiErrs.details[i];
        var path = detail.path;
  
        switch (format) {
          case 'mongoose':
            newErrs[path] = {
              message: convert(detail, options),
              name: 'ValidatorError',
              path: path,
              type: detail.type
            };
            break;
          default:
            newErrs[path] = convert(detail, options);
        }
      }
  
      return newErrs;
    };
  }
docs: Package