Skip to content

Instantly share code, notes, and snippets.

@baio
Created July 19, 2015 14:30
Show Gist options
  • Save baio/ec100d895bb5de260eb4 to your computer and use it in GitHub Desktop.
Save baio/ec100d895bb5de260eb4 to your computer and use it in GitHub Desktop.
var list1 = Immutable.fromJS([{a: 10}, {a : 20}]);
var list2 = Immutable.fromJS([{a: 10}, {a : 20}]);
//var list2 = list1.merge(list2);
var list3 = list1.mergeDeep(list2);
var newVal = [{a: 10}, {a : 20}];
var list4 = list1.update(function (value) {
var nv = Immutable.fromJS(newVal);
return Immutable.is(list1, newVal) ? value : nv;
});
console.log(list1 === list3);
console.log(list1 === list4);
console.log(list3.toJS());
console.log(Immutable.is(list1, list3));
console.log(Immutable.is(list1, list4));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment