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

[New] stringify: throw on cycles, instead of an infinite loop #393

Merged
merged 2 commits into from Mar 17, 2021
Merged

[New] stringify: throw on cycles, instead of an infinite loop #393

merged 2 commits into from Mar 17, 2021

Conversation

Poyoman39
Copy link

@Poyoman39 Poyoman39 commented Jan 27, 2021

Fix issue #367 with "maxDepth" option.

@codecov
Copy link

codecov bot commented Jan 27, 2021

Codecov Report

Merging #393 (d493679) into master (e40c0e0) will decrease coverage by 0.86%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #393      +/-   ##
==========================================
- Coverage   99.85%   98.98%   -0.87%     
==========================================
  Files           8        8              
  Lines        1363     1378      +15     
  Branches      166      167       +1     
==========================================
+ Hits         1361     1364       +3     
- Misses          2       14      +12     
Impacted Files Coverage Δ
lib/stringify.js 100.00% <100.00%> (ø)
test/stringify.js 96.79% <100.00%> (-2.95%) ⬇️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update e40c0e0...74dd9d2. Read the comment docs.

ljharb
ljharb previously requested changes Jan 27, 2021
Copy link
Owner

@ljharb ljharb left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

We'd definitely need tests for this; but i'm not sure a max depth is a proper fix for the solution - typically it's done by recognizing "seen objects" in some kind of WeakMap/Map/array solution.

@Poyoman39
Copy link
Author

Ok i will provide a Map solution ;)

ljharb and others added 2 commits March 17, 2021 15:00
Fixes #367.

Co-authored-by: Jordan Harband <ljharb@gmail.com>
Co-authored-by: Johan <johan@pop-os.localdomain>
@ljharb ljharb changed the title Fix #367 [New] stringify: throw on cycles, instead of an infinite loop Mar 17, 2021
@ljharb ljharb dismissed their stale review March 17, 2021 22:19

handled in #395

@ljharb ljharb merged commit 63766c2 into ljharb:master Mar 17, 2021
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

Successfully merging this pull request may close these issues.

None yet

2 participants