Skip to content

fix: handle custom classes with null proto as pojo #95

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

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

Conversation

pi0
Copy link

@pi0 pi0 commented Apr 8, 2025

There is a common pattern that libraries like ufo and cookie use to have a custom class with null prototype instead of Object.create(null) to improve (v8) performance.

This PR fixes the devalue behavior to support this pattern.

Since there is no obvious way to distinguish {} and new NullProto() (both have prototype of [Object: null prototype]), they are serialized as normal object (with prop oveerrides)

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