Advertisement
Guest User

Untitled

a guest
Oct 23rd, 2016
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. # Structured and Nested
  2. obj = {
  3. container_a = {
  4. name: "Foo",
  5. contents: [item_a, item_b, item_e]
  6. }
  7. container_b = {
  8. name: "Bar",
  9. contents: [item_c, item_d, item_z]
  10. }
  11. }
  12.  
  13. ## VS
  14.  
  15. # Unstructured and Flat
  16.  
  17. obj = {
  18. contents: [
  19. { val: item_a, location: 'container_a' },
  20. { val: item_b, location: 'container_a' },
  21. { val: item_c, location: 'container_b' },
  22. { val: item_d, location: 'container_b' },
  23. { val: item_e, location: 'container_a' },
  24. { val: item_z, location: 'container_b' },
  25.  
  26. ]
  27. }
  28.  
  29. move_item(obj, item_e, 'container_b')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement