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

Uncaught Error: TypeError: � Chromafi: Converting circular structure to JSON #5

Open
emahuni opened this issue Sep 26, 2018 · 5 comments

Comments

@emahuni
Copy link

emahuni commented Sep 26, 2018

If an object has any circular references, or objects that refer to themselves this is what Chromafi throws.

const chroma = require('chromafi');
let huga = { foo: 'bar' }; // define an object
huga.huga = huga; // create a circular ref

chroma(huga); // throws the above error

Cant the code simple put '[circular]' in place of the code that is circular?

@emahuni
Copy link
Author

emahuni commented Sep 26, 2018

I think I have got the solution to this, let me code it and make a pull request.

@emahuni
Copy link
Author

emahuni commented Sep 27, 2018

ahhh the solution, i tried a yesterday, it is slow. I used safe-json-stringify in place of JSON.stringify, there are a lot of issues that came with it. I then used util.inspect, but chromafi doesn't highlight code nor stringify functions. Will let you know progress if I get anywhere.

@F1LT3R
Copy link
Owner

F1LT3R commented Sep 27, 2018

emahuni added a commit to emahuni/chromafi that referenced this issue Sep 28, 2018
@emahuni
Copy link
Author

emahuni commented Sep 28, 2018

Just made a pr of the first solution. Please check it out i think this is the way to go, we start from there.

@F1LT3R
Copy link
Owner

F1LT3R commented Oct 22, 2018

It looks like you need to update the "circular json throws" test. I'm assuming the code will never throw with your update?

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