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

undefined not supported #7

Closed
Hypnosphi opened this issue Apr 23, 2019 · 4 comments · Fixed by #19
Closed

undefined not supported #7

Hypnosphi opened this issue Apr 23, 2019 · 4 comments · Fixed by #19
Labels
bug Something isn't working

Comments

@Hypnosphi
Copy link
Member

See storybookjs/storybook#4487 (comment)

parse(stringify({foo: undefined}))
> {}
@christophehurpeau
Copy link

christophehurpeau commented Jul 5, 2019

This is the spec of JSON.parse that removes undefined values, I can't see how we could fix this ?

@christophehurpeau
Copy link

https://www.ecma-international.org/ecma-262/5.1/#sec-15.12.2

If it returns undefined then the property is deleted from the result.

@Hypnosphi
Copy link
Member Author

Hypnosphi commented Jul 5, 2019

I can't see how we could fix this

Iterate over keys instead of using JSON.parse?

@christophehurpeau
Copy link

christophehurpeau commented Jul 11, 2019

Note that undefined is only not "supported" when it's a value in an object.
For example, the following works:

telejson.parse(telejson.stringify([undefined]))

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants