Message from JavaScript discussions

July 2017

— 

// Unique Node Map
var nodeMap = new Map();

— 

If node is not in map, add it to map. If it is in map, that means it was seen before and should not be traversed into or cloned

— But, that is a linear check that takes longer the more of an object tree you have traversed

— Yeah..

— Me no likey, but IDK how to do it any other way at the moment... maybe duck typing

— Crazy fun to be able to recreate cycles though

— Check for the list of props in a sorted radix tree would be a good improvement, then if we just don't have that combo of props we know we haven't seen an object

Message permanent page

— I could maybe use that string set I was working on before

— Oh yes, perfectly clones objects (almost)

— Why just almost?

— Descriptors aren't copied and only enumerables are copied

— You can look up getters / setters, prototypes, etc