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

Any plans to support circular structures? #110

Open
Judahh opened this issue Feb 15, 2021 · 3 comments
Open

Any plans to support circular structures? #110

Judahh opened this issue Feb 15, 2021 · 3 comments

Comments

@Judahh
Copy link

Judahh commented Feb 15, 2021

No description provided.

@juandopazo
Copy link
Member

Hi @Judahh, unless I'm mistaken I believe the only way to support them would be to create a new protocol and a new "parse" method. That would go a bit past what I think the original design goal was (to be able to just eval the serialized result).

@undefined-moe
Copy link

I think its possible to serialize as the following:

(() => {
  const t = {}; // some base structure
  t.foo = t; // do some magic
  return t;
})();

This becomes a little bit tricky, and I don't know is this feature really needed in most use cases.

@EmileSonneveld
Copy link

I made a tool that does what serialize-javascript does, but also added support for circular references, duplicate objects and more:
https://github.com/emilesonneveld/serialize-to-js

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

4 participants