Skip to content

util: .inspect() misformats __proto__ property on prototype-less object #3788

Closed
@bnoordhuis

Description

> var o = Object.create(null); o.__proton__ = 42; util.inspect(o)
'{ __proton__: 42 }'  // no brackets

> var o = Object.create(null); o.__proto__ = 42; util.inspect(o)
'{ [__proto__]: 42 }'  // brackets

I speculate arrayToHash() needs to use Object.create(null) for its dictionary object.

Metadata

Assignees

No one assigned

    Labels

    good first issueIssues that are suitable for first-time contributors.utilIssues and PRs related to the built-in util module.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions