Skip to content

Add freeze and preferNullPrototype options for parse() and .toJS() - #727

Open
eemeli wants to merge 2 commits into
mainfrom
freeze
Open

eemeli wants to merge 2 commits into
mainfrom
freeze

Conversation

@eemeli

@eemeli eemeli commented Sep 23, 2026

Copy link
Copy Markdown
Owner

This adds freeze and preferNullPrototype options corresponding to the ones introduced by JSON.parse Options Proposal.

With freeze enabled, the Object and Array values corresponding to mappings and sequences are deeply frozen.

With preferNullPrototype, Object values corresponding to mappings are created with Object.create(null).

@fisker

fisker commented Sep 23, 2026

Copy link
Copy Markdown

Why preferNullPrototype, not nullPrototype?

@eemeli

eemeli commented Sep 23, 2026

Copy link
Copy Markdown
Owner Author

Why preferNullPrototype, not nullPrototype?

Because that's the one currently in the upstream proposal: https://tc39.es/proposal-json-parseimmutable/#sec-createjsonparseoptions

Suggest you ask this question in its repo? https://github.com/tc39/proposal-json-parseimmutable

@fisker

fisker commented Sep 23, 2026

Copy link
Copy Markdown

This branch has not been deployed

No deployments
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.

2 participants