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

do not call toJSON more than once #7

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

darrachequesne
Copy link
Member

In order to match JSON.stringify's behaviour:

var o = { toJSON: function() { return this; } };
JSON.stringify(o)
'{}'
hasBinary(o)
false (previously "RangeError: Maximum call stack size exceeded")

In order to match JSON.stringify's behaviour:

> var o = { toJSON: function() { return this; } };
> JSON.stringify(o)
'{}'
> hasBinary(o)
false (previously "RangeError: Maximum call stack size exceeded")
darrachequesne added a commit to darrachequesne/has-binary that referenced this pull request Apr 5, 2017
In order to match JSON.stringify's behaviour:

> var o = { toJSON: function() { return this; } };
> JSON.stringify(o)
'{}'
> hasBinary(o)
false (previously "RangeError: Maximum call stack size exceeded")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
1 participant