Learn how to query an Immutable.Map() using get, getIn, has, includes, find, first and last. These are powerful operators that make finding data in an object graph pain free. has, includes, contains: //has() var map = Immutable.Map({a: '10'}); consol…
We will now look at five methods that modify an Immutable.Map(). set update delete clear merge //set() var map = Immutable.Map(); var todo = { id: +new Date(), name: "todo1", content: "learning Immutable" } map = map.set(todo.id, todo)…
Learn how to create an Immutable.Map() through plain Javascript object construction and also via array tuples. console.clear(); // Can be an object var map = Immutable.Map({key: "value"}); console.log(map.get("key")); //"value&quo…
The Immutable.js Map() is analogous to a Javascript Object or Hash since it is comprised of key-value pairs. The Immutable.js List() is analogous to a Javascript Array and contains many of the same native methods. Let's compare the two and dive into…
Immutable.js offers methods to break immutable structures into subsets much like Array--for instance it has the all powerful slice()--and unlike Array it offers functional methods like take() and skip(). You get the best of both the imperative and fu…
Immutable.js provides several methods to iterate over an Immutable.Map(). These also apply to the other immutable structures found within the Immutable.js family, such as Set and List. The primary methods are map and forEach, but we will also cover f…
Immutable.js provides several conversion methods to migrate one structure to another. Each Immutable.js class contains a prefixed "to" method like Map.toList(), Map.toSet(), etc. Converting these types sometimes results in a loss of data, as we…
Learn how Immutable.js data structures are different from native iterable Javascript data types and why they provide an excellent foundation on which to build your application's state. Instead of them being mutable, they're always immutable, meaning…
Immutable.js offers the fromJS() method to build immutable structures from objects and array. Objects are converted into maps. Arrays are converted into lists. The fromJS() method can also take a reviver function for custom conversions. Object to Im…