Created
September 27, 2016 20:28
-
-
Save Albert-IV/4e7a96a523601c7f1f9ac5555465d70c to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
fieldKeys = { | |
"1": "Name", | |
"2": "Email", | |
"3": "Some Field" | |
} | |
usefulInfo = entries.map(function(entryArr) { | |
return entryArr.reduce(function(obj, row, idx) { | |
var correctKey = fieldKeys[idx] | |
obj[correctKey] = row; | |
return obj; | |
}, {}) | |
}) | |
// usefulInfo == [{ | |
// "Name": "Some Name", | |
// "Email" "[email protected]", | |
// "Some Field" : "WOOOO" | |
// },{ | |
// "Name": "Some Name", | |
// "Email" "[email protected]", | |
// "Some Field" : "WOOOO" | |
// },{ | |
// "Name": "Some Name", | |
// "Email" "[email protected]", | |
// "Some Field" : "WOOOO" | |
// },{ | |
// "Name": "Some Name", | |
// "Email" "[email protected]", | |
// "Some Field" : "WOOOO" | |
// }] |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment