jsesc
jsesc copied to clipboard
detect and throw on cyclic references
For example:
const cyclic = {};
cyclic.cyclic = cyclic;
// RangeError: Maximum call stack size exceeded
jsesc(cyclic);
I think this is typically done by tracking an array of seen values and pushing/popping when entering/exiting a recursive jsesc
call. I might be able to implement if acceptable.