Skip to content

do not call toJSON more than once#7

Open
darrachequesne wants to merge 1 commit intosocketio:masterfrom
darrachequesne:fix/tojson-once
Open

do not call toJSON more than once#7
darrachequesne wants to merge 1 commit intosocketio:masterfrom
darrachequesne:fix/tojson-once

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

Development

Successfully merging this pull request may close these issues.

1 participant