Match Date Result
Twins vs Yankees 17-10-03 4 - 8
Rockies vs Diamondbacks 17-10-04 8 - 11
Red Sox vs Astros 17-10-05 2 - 8
function process(input, columns) {
var output = [];
input.forEach(function(inRow, r) {
var outRow = {};
var teams = inRow.Match.split('vs');
outRow.Home = teams[0].trim();
outRow.Away = teams[1].trim();
var date = moment(inRow.Date, 'YY-MM-DD');
outRow.Date = date.format('MMM Do YYYY');
var scores = inRow.Result.split('-');
outRow['Home Score'] = parseInt(scores[0].trim(), 10);
outRow['Away Score'] = parseInt(scores[1].trim(), 10);
outRow.Winner = outRow['Home Score'] > outRow['Away Score'] ? outRow.Home : outRow.Away;
if (outRow['Home Score'] == outRow['Away Score']) outRow.Winner = 'Tie';
output.push(outRow);
});
return output;
}
function process(input, columns) {
var output = [];
input.forEach(function(inRow, r) {
var outRow = {};
// Change this code
outRow = inRow;
output.push(outRow);
});
return output;
}