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

Is returned Symbol value expected to be serialized as an empty object for executing script? #1675

Open
CYBAI opened this issue Jul 14, 2022 · 0 comments

Comments

@CYBAI
Copy link

CYBAI commented Jul 14, 2022

while trying to return a Symbol (like following script) from execute sync command, I realized the Symbol will be serialized into an empty object.

return Symbol(1);

Based on the internal JSON clone algorithm, if the value is a Symbol, it will run to the last Otherwise branch. Thus, IIUC, it will get into clone an object and end up returning an empty object.

However, JSON.stringify(Symbol(1)) returns undefined. It's not serialized into an empty object. So, I wonder if we should serialize Symbol values to null (like what undefined is serialized) as well?

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

No branches or pull requests

1 participant