Querying an Immutable.js Map()

Share this video with your friends

Send Tweet

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.

awv-inf
awv-inf
~ 8 years ago

The official immutable.js docs are impossible to read, that is why people come here.

But instead of learning how these functions work we're covering wrappers, abstractions and tests.

I really wish you would have just used the functions as they are, show what they return, thereby cutting the lessons time in half. Right now i am not sure if i better crawl through robotic typescript definitions than watch yet another test that calls this and that wrapper named differently than the immutable method way outside the view comparing results not shown.

J.S. Leonard
J.S. Leonard(instructor)
~ 8 years ago

Hi @awv-inf. Thanks for the feedback. Some love the TDD approach and others have expressed your same concern. Will definitely try to find a happy medium in the future!

Kostiantyn Hryshyn
Kostiantyn Hryshyn
~ 8 years ago

I suppose you have the typo in the case "should find nested keys":

    var todos = Immutable.Map();
    var todos2 = Immutable.Map();
    
    _.each(_.range(10), (index) => {
      todos = ....
    });

    _.each(_.range(10), (index) => {
      todos = ...
    });

The second one for _.each should be todos2... Am I right? Because if we check console.log(todos.size) right after the _.each... the result will be 1...

I such case we can goo deeper and verify it:

const todo2ID = todos2.last().id;
expect(multipleTodoStates.getIn(["todo2", todo2ID], null)).to.equal(todos2.last());
Shreya
Shreya
~ 8 years ago

TDD is a good approach to teaching a new library, However the author could have used more imagination while naming variables. "todo" this and "todo" that... was not the easiest to follow.

Also the helper functions should have been avoided.

HK
HK
~ 7 years ago

TDD is a good approach to teaching a new library, However the author could have used more imagination while naming variables. "todo" this and "todo" that... was not the easiest to follow.

Also the helper functions should have been avoided.

I agree...

Fabio Cortes
Fabio Cortes
~ 7 years ago

This approach is really hard to follow

Dustin Sinkey
Dustin Sinkey
~ 6 years ago

This course it terrible. I watched the Dan Abramov course on Redux and it was excellent. I thought this course would be as insightful to Immutable.js as Dan's was to Redux, but after almost 1/3 of the course I feel like I've gain zero insight into Immutable. I'll be asking for my money back from Egghead, because I purchased it just for this course and it's so bad.