Skip to content

Instantly share code, notes, and snippets.

@kentquirk
Created September 10, 2016 18:19
Show Gist options
  • Save kentquirk/abc19a77de1bbdff977855dc5cc951b1 to your computer and use it in GitHub Desktop.
Save kentquirk/abc19a77de1bbdff977855dc5cc951b1 to your computer and use it in GitHub Desktop.
Using lodash we can make it look like Python
// requires lodash.js
var output = {}
_.each(input, function(element){
a = _.get(output, element.owner, [])
a.push(element.pet)
output[element.owner] = a
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment