Created
March 14, 2017 14:11
-
-
Save AJFaraday/daf04899ee573628c35768548cf1a7fd to your computer and use it in GitHub Desktop.
How can I do this
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
# underpants | |
data = [ | |
{a: 1, b: 1, c: 'a'}, | |
{a: 1, b: 2, c: 'b'}, | |
{a: 2, b: 2, c: 'c'} | |
] | |
# ? | |
new_data = transform_data(data) | |
# profit! | |
new_data[1][1] | |
# => 'a' | |
new_data[1][2] | |
# => 'b' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
I only use
inject
if I'm not modifying anything. If I'm doing any sort of mutation, I useeach_with_object
. When building state from scratch, mutation is just faster, so I useeach_with_object
waaaaay more thaninject
.