Skip to content

Instantly share code, notes, and snippets.

@jagregory
Created October 18, 2013 00:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jagregory/7034826 to your computer and use it in GitHub Desktop.
Save jagregory/7034826 to your computer and use it in GitHub Desktop.
var projections = Object.keys(serverData)
.map(function(k) {
return serverData[k].totals.map(function(t, i) {
var row = { y: i + 1 }
row[serverData[k].commissionStructure] = t.total.value
return row
})
})
var result = projections[0]
projections.forEach(function(projection) {
projection.forEach(function(row, i) {
Object.keys(row).forEach(function(k) {
result[i][k] = row[k]
})
})
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment