Skip to content

Functional updates drop unrelated symbol properties from plain objects #2289

Description

@xu91102

Updating a plain object through the functional helpers silently drops its enumerable symbol properties:

const metadata = Symbol('metadata');
const original = { x: 1, [metadata]: 'keep' };
set(original, 'x', 2); // { x: 2 }, expected { x: 2, [metadata]: 'keep' }
remove(original, 'x'); // {}, expected { [metadata]: 'keep' }

update has the same behavior. These properties are unrelated to the changed key and should survive the copy, as enumerable string properties do. Reproduced on current main with Node 22.23.2 on macOS. A public-API regression test fails before the fix. Prepared with Codex assistance.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions