jsesc icon indicating copy to clipboard operation
jsesc copied to clipboard

detect and throw on cyclic references

Open skeggse opened this issue 4 years ago • 0 comments

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.

skeggse avatar Apr 01 '20 01:04 skeggse