3 ms·
Alas, the ES6 Map/Set implementation almost only does identity-equality (===) so you have to jump through extra hoops in order to get something like Python or J
by Terr_ 8y ago
Alas, the ES6 Map/Set implementation almost only does identity-equality (===) so you have to jump through extra hoops in order to get something like Python or Java. (That is, with equals() / hashCode() or __eq__() / __hash__() respectively.)
In other words, you can't have two (immutable) "Address" objects resolve to the same storage spot, even if they are functionally identical in every way.
I had a mini-project a while back, making a Typescript 3 Map/Set class which would be familiar to Java/Python folks. The main difference being no predefined functions, you simply pass the data-structure some functions it can use to operate on the objects.
I'd like to throw it up on Github, but unfortunately it's still technically the property of my employer. Think it's worth asking?