Skip to content

Instantly share code, notes, and snippets.

@prakhar1989
Created May 25, 2015 00:06
Show Gist options
  • Save prakhar1989/f3142bd6fb46e68c4db1 to your computer and use it in GitHub Desktop.
Save prakhar1989/f3142bd6fb46e68c4db1 to your computer and use it in GitHub Desktop.
immutable.js
var Block = Immutable.Record({
id: 0,
questions: Immutable.List(),
subblocks: Immutable.List(),
randomizable: true,
ordering: false
});
var b1 = Block({id: 1});
var b2 = b1.set('randomizable', false);
var b3 = b2.set('randomizable', true);
console.log("b1 and b2:", b1 === b2); // returns false
console.log("b1 and b3:", b1 === b3); // also returns false
console.log("b1 and b2:", Immutable.is(b1, b2)); // returns false
console.log("b1 and b3:", Immutable.is(b1, b3)); // returns true
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment