Advertisement
Guest User

Untitled

a guest
Jan 31st, 2015
178
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.43 KB | None | 0 0
  1. // require() some stuff from npm (like you were using browserify)
  2. // and then hit Rebuild to run it on the right
  3. var immstruct = require('immstruct');
  4. var structure = immstruct({foo: {bar: 'hello'}});
  5.  
  6. //update the cursor
  7. structure.cursor('foo').update('bar', function () { return 'newbar' });
  8.  
  9. //set new key in immutable data structure
  10. structure.cursor('foo').set('baz', 'foobaz');
  11. alert(JSON.stringify(structure.cursor('foo').toJSON()));
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement