Closed
Description
Immutable version 3.8.1
I must be doing something seriously wrong, or have missed something fundamental:
$ node
> var Immutable = require('immutable');
> var m = Immutable.Map();
> m.size
0
> m = m.update(42, "hello", (x => x));
Map {}
> m.size
0
Why wasn't "hello" inserted into the map? According to the docs, update is:
Equivalent to: map.set(key, updater(map.get(key, notSetValue))).
Let's try running that instead:
> m = m.set(42, (x => x)(m.get(42, "hello")))
Map { 42: "hello" }
> m.size
1
That seemed to work just fine! So why didn't "update" work?
Metadata
Metadata
Assignees
Labels
No labels