Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support for circular references #2

Closed
mjackson opened this issue Dec 9, 2015 · 4 comments
Closed

Support for circular references #2

mjackson opened this issue Dec 9, 2015 · 4 comments

Comments

@mjackson
Copy link

mjackson commented Dec 9, 2015

This issue is a follow-up on #1.

It would be nice to be able to test for equality with objects that contain circular references. See mjackson/expect#50 for an instance of where this would be useful.

@ljharb
Copy link
Member

ljharb commented Dec 10, 2015

This appears to already work - I'm sure there's some edge cases that it won't work for, but the case you provided does work.

@ljharb ljharb closed this as completed in 3edf8de Dec 10, 2015
ljharb added a commit that referenced this issue Dec 10, 2015
…atter.

Fixes #3 (comment)

This reopens #2 and disables the test for circular reference handling.
@ljharb ljharb reopened this Dec 10, 2015
@ljharb
Copy link
Member

ljharb commented Dec 10, 2015

This was fixed by 2517c21, but that change introduced an unintentional breaking change, so it was reverted in ccb8a3e.

@ljharb ljharb closed this as completed in 2454f52 Dec 11, 2015
@ljharb
Copy link
Member

ljharb commented Dec 11, 2015

I've restored basic circular reference support, but note that there will likely be edge cases (PRs welcome). The only true way to handle this would be using a Map (and a fallback for < ES6) to track any seen value, where the map key was the value and the map value was a Set of things determined to be equal to it.

It's pretty complex so I'd prefer not to have to do it without compelling use cases.

@ljharb
Copy link
Member

ljharb commented Dec 11, 2015

Released as v1.4.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants