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

Capture and play voice with Asterisk ARI -

c++ - Can not find the "fiostream.h" file -

java - Why database contraints in HSQLDB are only checked during a commit when using transactions in Hibernate? -