Skip to content

Determine if a method is deprecated in code #22524

Closed
@dougwilson

Description

@dougwilson

I'm looking for a method in which use-land Node.js code can determine if a method in Node.js has been marked deprecated or not prior to calling it. It looks like this is typically done with util.deprecate. It seems like from an issue discussion the method to do this is to use .propertyIsEnumerable. Is this the correct way to go about this type of detection?

If this is the agreeable way to detect the deprecated things in Node.js, I can volunteer to make a pull request to update the util.deprecate documentation and add a test to the test suite to validate things from util.deprecate work this way. I just wanted to make sure I'm understanding correctly and this is the right path for user-land detection prior to opening a PR 👍

Edit: I opened this as it's own issue so conversation wouldn't get lost in an unrelated PR.

Metadata

Metadata

Assignees

No one assigned

    Labels

    deprecationsIssues and PRs related to deprecations.questionIssues that look for answers.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions