{"size": 470, "ext": "js", "max_stars_repo_path": "ref/012.runnerNamesFromCategories.js", "max_stars_repo_name": "charl-nml/js-array-for-vs-operators", "max_stars_repo_stars_event_min_datetime": "2020-03-11T09:55:17.000Z", "max_stars_repo_stars_event_max_datetime": "2020-03-11T09:55:17.000Z", "max_issues_repo_path": "ref/012.runnerNamesFromCategories.js", "max_issues_repo_name": "charl-nml/js-array-operations-vs-for-loops", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "ref/012.runnerNamesFromCategories.js", "max_forks_repo_name": "charl-nml/js-array-operations-vs-for-loops", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": 1, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 39.1666666667, "max_line_length": 115, "alphanum_fraction": 0.7212765957}
import {runnersByTenthsOfASecond as runners} from "../data/runners.js"

function runnerNamesFromCategories(runnersByTenthsOfASecond) {
    return runnersByTenthsOfASecond
        .flatMap(category => category.runners)
        .map(runner => runner.name);

    /* Using reduce + map */
    // return runnersByTenthsOfASecond.reduce((acc, cur) => acc.concat(cur.runners.map(runner => runner.name)), [])
}

console.log("Runner names: ", runnerNamesFromCategories(runners));