{"size": 387, "ext": "js", "max_stars_repo_path": "src/index.js", "max_stars_repo_name": "ibn-salamat/towel-sort", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "src/index.js", "max_issues_repo_name": "ibn-salamat/towel-sort", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "src/index.js", "max_forks_repo_name": "ibn-salamat/towel-sort", "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": 27.6428571429, "max_line_length": 77, "alphanum_fraction": 0.5219638243}
module.exports = function towelSort(matrix) {
    let result = [];
    if (matrix == undefined || matrix.length == 0) {
        return result;
    } else if (matrix.length == 1) {
        return matrix;
    } else {
        matrix.forEach((item, index) => {
            index % 2 == 0 ? result.push(item) : result.push(item.reverse());
        });
        return result.flat();
    }
};
