javascript - testing equality when there's a mutable inside an immutable.js structure -


testing equality pretty easy when immutable:

a = map({foo: 1}); b = map({foo: 1}); is(a,b) //true 

now, let's put mutable structure inside:

a = map({foo:{bar: 1}}); b = map({foo:{bar: 1}}); is(a,b) //false 

dang! what's cleanest way accomplish this? (yeah, yeah, know mutables inside immutable sick & wrong, can't control folks put inside structures)

a couple ideas:

  • use tojs , deepequal native objects. don't since lose lot of control on things item order, etc.
  • recursively use fromjs this, think it's best approach, assuming don't know shape of mutable, can't figure out how in line or 2. code examples welcomed!
  • ???


Comments

Popular posts from this blog

ruby - Trying to change last to "x"s to 23 -

jquery - Clone last and append item to closest class -

css - Can I use the :after pseudo-element on an input field? -