Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@nikeee
Copy link
Contributor

@nikeee nikeee commented Sep 28, 2025

Follow-up to #55 to further remove dependencies and should be merged afterwards.

Replace has-own-prop with Object.hasOwn
The docs of has-own-prop state:

If you are targeting Node.js 16+ or browsers, use Object.hasOwn() instead.

Object.hasOwn is intended for that use, as per MDN:

It is recommended over Object.prototype.hasOwnProperty() because it works for null-prototype
objects and with objects that have overridden the inherited hasOwnProperty() method.
While it is possible to workaround these problems by accessing
Object.prototype.hasOwnProperty() on another object
(like Object.prototype.hasOwnProperty.call(obj, prop), Object.hasOwn() is more intuitive and concise.

The [docs of has-own-prop](https://github.com/sindresorhus/has-own-prop) state:
> If you are targeting Node.js 16+ or browsers, use Object.hasOwn() instead.

`Object.hasOwn` is intended for that use, [as per MDN](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwn):
> It is recommended over `Object.prototype.hasOwnProperty()` because it works for `null`-prototype
> objects and with objects that have overridden the inherited `hasOwnProperty()` method.
> While it is possible to workaround these problems by accessing
> `Object.prototype.hasOwnProperty()` on another object
> (like `Object.prototype.hasOwnProperty.call(obj, prop)`, `Object.hasOwn()` is more intuitive and concise.
@kaelzhang kaelzhang merged commit f66793a into kaelzhang:master Sep 29, 2025
1 check failed
@nikeee nikeee deleted the has-own branch September 29, 2025 01:34
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

Successfully merging this pull request may close these issues.

2 participants