util: use proper circular reference checking
Circular references are conceptually nothing that should be checked for objects (or Sets or Maps) only, but applies to recursive structures in general, so move the `seen` checks into a position where it is part of the recursion itself. Fixes: https://github.com/nodejs/node/issues/14758 PR-URL: https://github.com/nodejs/node/pull/14790 Reviewed-By:Refael Ackermann <refack@gmail.com> Reviewed-By:
James M Snell <jasnell@gmail.com> Reviewed-By:
Evan Lucas <evanlucas@me.com> Reviewed-By:
Timothy Gu <timothygu99@gmail.com> Reviewed-By:
Colin Ihrig <cjihrig@gmail.com> Reviewed-By:
Tobias Nießen <tniessen@tnie.de> Reviewed-By:
Yuta Hiroto <hello@about-hiroppy.com> Reviewed-By:
Alexey Orlenko <eaglexrlnk@gmail.com> Reviewed-By:
Ruben Bridgewater <ruben.bridgewater@fintura.de>
parent
dcd7817f
Please register or sign in to comment