-
Notifications
You must be signed in to change notification settings - Fork 18
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
Fix #5 circular structure error #6
base: master
Are you sure you want to change the base?
Conversation
used safe json stringify instead of native JSON.stringify to eliminate error when converting objects with circular structure or getter functions. note, i tried this with sails object, it works but it's a bit slow.
The travis fail is actually a test that's validating the bug as acceptable. I dont use ava maybe you could fix that upstream, pliz |
@emahuni how large do you mean? (Your JSON blob in KB stringified?) I'd designed Chromafi to be used in small chunks of code that could be highlighted to show errors, or exported to SVG with ANSI-to-SVG when building example code blocks with crisp graphics for readme files. What's your use case? |
Have you tried converting your object to a string and using Chromafi on that string with the It's possible that will give you faster results. |
I have built a console trace logger Contrace that uses this for outputting objects, function etc for clean and intuitive logging. I then use this as the Sails logger of choice as it shows the source of logs etc. I think with the new modifications I have done in this PR, it's ok for its intended usecase. let me update Contrace with the latest code changes |
If you update the "circular json throws" test, I'm happy to merge your changes. |
This works but was slow when working with large objs
It also fixes objects that have getters...
Check this out and see if it is an exceptable solution. Or we could disect the new module to make a much leaner solution out of it that is faster for this purpose.