Skip to content

fix: ignore functions without mutating input objects - #233

Merged
redonkulus merged 1 commit into
yahoo:mainfrom
Shubham-Padkonde:fix/ignore-functions-without-mutation
Oct 22, 2026
Merged

redonkulus merged 1 commit into
yahoo:mainfrom
Shubham-Padkonde:fix/ignore-functions-without-mutation

Conversation

@Shubham-Padkonde

Copy link
Copy Markdown
Contributor

Using ignoreFunction: true currently deletes function-valued properties from the input object. Besides modifying caller-owned data, this throws for frozen objects and turns functions in dense arrays into holes rather than the null values produced by JSON.stringify.

Let JSON.stringify handle function values returned by the replacer instead of deleting properties. This preserves the documented JSON-like behavior of ignoreFunction while retaining the original objects and arrays.

Three regression tests fail before the fix: nested-object mutation, frozen objects, and functions in arrays. All 103 tests pass afterward (node --test test/unit/*.js), and git diff --check passes.

@redonkulus
redonkulus merged commit 45e5397 into yahoo:main Oct 22, 2026
4 checks passed
@redonkulus

Copy link
Copy Markdown
Collaborator

Thank you for contributing!

@redonkulus redonkulus mentioned this pull request Oct 22, 2026
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