marcello3d / node-tosource

Converts JavaScript objects to source

Home Page:https://github.com/marcello3d/node-tosource

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Incorrect $circularReference

Rich-Harris opened this issue · comments

I don't have time to file a PR right now but can try and do so later - just thought I'd flag this in the meantime:

foo = [];
obj = { foo: foo, bar: foo };

toSource( obj );
// -> "{ foo:[  ], bar:{$circularReference:1} }"

Expected would be { foo:[], bar:[] } since foo doesn't contain bar.

Good catch. Definitely need to add a test suite to this package.