Created
October 23, 2016 00:31
-
-
Save jah2488/011db9a57eb42dcf18325e9459d2ae94 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
# Structured and Nested | |
obj = { | |
container_a = { | |
name: "Foo", | |
contents: [item_a, item_b, item_e] | |
} | |
container_b = { | |
name: "Bar", | |
contents: [item_c, item_d, item_z] | |
} | |
} | |
## VS | |
# Unstructured and Flat | |
obj = { | |
contents: [ | |
{ val: item_a, location: 'container_a' }, | |
{ val: item_b, location: 'container_a' }, | |
{ val: item_c, location: 'container_b' }, | |
{ val: item_d, location: 'container_b' }, | |
{ val: item_e, location: 'container_a' }, | |
{ val: item_z, location: 'container_b' }, | |
] | |
} | |
move_item(obj, item_e, 'container_b') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment