Created
May 25, 2015 00:06
-
-
Save prakhar1989/f3142bd6fb46e68c4db1 to your computer and use it in GitHub Desktop.
immutable.js
This file contains 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
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