Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

in version require.extensions.hasOwnProperty is undefined #17976

Closed
hananyabeck opened this issue Jan 4, 2018 · 2 comments
Closed

in version require.extensions.hasOwnProperty is undefined #17976

hananyabeck opened this issue Jan 4, 2018 · 2 comments

Comments

@hananyabeck
Copy link

  • Version: 8.9.3
  • Platform:
  • Subsystem:

After i upgrade to 8.9.3
require.extensions.hasOwnProperty is undefined
node -e "console.log(require.extensions.hasOwnProperty)" = undefined

in version 6.10.3
i got
node -e "console.log(require.extensions.hasOwnProperty)" = [Function: hasOwnProperty]

@TimothyGu
Copy link
Member

This is an intentional change. You should always use Object.prototype.hasOwnProperty.call(obj, propKey) for safety, regardless of what kind of object it is.

@evanlucas
Copy link
Contributor

I'm going to go ahead and close this as it is not a bug since require.extensions is an object a null prototype.

Ref: https://github.com/nodejs/node/blob/master/lib/module.js#L88
Ref: https://github.com/nodejs/node/blob/master/lib/internal/module.js#L32

There is more information on why the change was made in #10789

Thanks!

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

No branches or pull requests

3 participants