Skip to content

Instantly share code, notes, and snippets.

@ablanchet
Created July 2, 2014 09:50
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 ablanchet/f8b9c3ece0812ebf3f3c to your computer and use it in GitHub Desktop.
Save ablanchet/f8b9c3ece0812ebf3f3c to your computer and use it in GitHub Desktop.
From collection to object with Underscorejs
_.chain([{k: 'toto', v: 1},{k: 'titi', v:2}])
.map(function(kv){
return [kv.k, kv.v];
})
.object()
.value();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment