Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # 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')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement