{"size": 656, "ext": "js", "max_stars_repo_path": "routes/index.js", "max_stars_repo_name": "marcellodesales/newww", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "routes/index.js", "max_issues_repo_name": "marcellodesales/newww", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "routes/index.js", "max_forks_repo_name": "marcellodesales/newww", "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": 21.8666666667, "max_line_length": 53, "alphanum_fraction": 0.6417682927}
var _ = require("lodash")
var public = require("./public");
var authenticated = require("./authenticated");
var routes = [];

public.concat(authenticated).forEach(function(route){

  // If route defines an array of paths,
  // register each as an individual route
  if (route.paths) {
    route.paths.forEach(function(path){
      var r = _.cloneDeep(route)
      delete r.paths
      r.path = path
      routes.push(r)
    })
  } else {
    routes.push(route);
  }
});

// Convenience method for tests
routes.at = function(name){
  return _.find(this, function(route) {
    return name === route.method + " " + route.path
  })
}

module.exports = routes;
