Skip to content

feat: Use toJSON for otherwise-empty objects #47

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

hashtagchris
Copy link
Contributor

deepMap currently returns empty objects ({}) for common types like Date and URL. This PR updates deepMap to check for a toJSON custom serialization function, and uses that to return a string representation of the object.

References

JSON.stringify also uses toJSON.

@hashtagchris hashtagchris requested a review from a team as a code owner May 8, 2025 15:11
@hashtagchris
Copy link
Contributor Author

hashtagchris commented May 8, 2025

Going to evaluate whether to always call toJSON if present, or just improve the serialization of instances of Date and URL specifically.

@hashtagchris hashtagchris marked this pull request as draft May 8, 2025 18:42
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