Skip to content

Make it possible to give externals names/util.inspect.custom #28250

Description

@emilbayes

Is your feature request related to a problem? Please describe.

In hyperdivision/hid we use externals as handles for device opaque descriptors, however during debugging it's hard to know what exactly you are working with. I want to preserve the opaqueness of the handles, but it would be nice if I could give these externals a name.

Describe the solution you'd like

Currently externals end up here in util.inspect:

return ctx.stylize('[External]', 'special');

I don't know if this should be another API in N-API, the possibility of setting util.inspect.custom or similar.

Describe alternatives you've considered

object_wrap is another alternative, but comes with much more features and boilerplate than I need. I just want to be able to give human readable names to opaque references for debugging.

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

    feature requestIssues requesting new Node.js features.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