{"size": 330, "ext": "js", "max_stars_repo_path": "lib/flatten-mongoose-validation-error.js", "max_stars_repo_name": "nepente/flatten-mongoose-validation-error", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "lib/flatten-mongoose-validation-error.js", "max_issues_repo_name": "nepente/flatten-mongoose-validation-error", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "lib/flatten-mongoose-validation-error.js", "max_forks_repo_name": "nepente/flatten-mongoose-validation-error", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 25.3846153846, "max_line_length": 82, "alphanum_fraction": 0.6575757576}
module.exports = function flattenMongooseValidationError(error, separator = ' ') {
  if (!error || error.name !== 'ValidationError') {
    return '';
  }
  const keys = Object.keys(error.errors);
  const messages = [];
  for (key of keys) {
    messages.push(error.errors[key].message);
  }

  return messages.join(separator);
};
