Skip to content

🐛 Fix hasOwn function implementation to ensure proper property checking #695

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

Merged
merged 1 commit into from
May 20, 2025

Conversation

welkinwong
Copy link
Contributor

In browsers that lack native Object.hasOwn support, assigning Object.prototype.hasOwnProperty.call to a variable (e.g., hasOwn = Object.prototype.hasOwnProperty.call) detaches the call method from its original function context. This results in a runtime error: hasOwn is not a function.

image

image

@coveralls
Copy link

Coverage Status

coverage: 97.465% (-0.03%) from 97.492%
when pulling 0baf4ee on welkinwong:fix-lib-hasown-lagacy
into a0c1f9d on share:master.

Copy link
Contributor

@ericyhwang ericyhwang left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the fix! We're unsure how the .call got through in the first place.

Coverage shows a drop, but that's fine since it's hard to test the fallback in any remotely recent version of Node.

@ericyhwang ericyhwang merged commit e3fffb7 into share:master May 20, 2025
4 of 8 checks passed
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.

3 participants