Skip to content

chore: use Object.hasOwn for iterator checks#4979

Merged
metcoder95 merged 1 commit intonodejs:mainfrom
trivikr:object-has-own
Apr 7, 2026
Merged

chore: use Object.hasOwn for iterator checks#4979
metcoder95 merged 1 commit intonodejs:mainfrom
trivikr:object-has-own

Conversation

@trivikr
Copy link
Copy Markdown
Member

@trivikr trivikr commented Apr 5, 2026

This relates to...

N/A

Rationale

Use Object.hasOwn() instead of Object.prototype.hasOwnProperty.call() for the remaining own-property checks in the iterator safety helpers. The repository already uses Object.hasOwn() elsewhere, and the current Node engine requirement supports it, so this keeps the codebase more consistent and modern without changing behavior.

Changes

  • Replace Object.prototype.hasOwnProperty.call(..., Symbol.iterator) with Object.hasOwn(..., Symbol.iterator) in the shared hasSafeIterator logic
  • Update the corresponding helper in the DNS interceptor to use the same pattern

Features

N/A

Bug Fixes

N/A

Breaking Changes and Deprecations

N/A

Status

@trivikr trivikr marked this pull request as ready for review April 5, 2026 22:23
@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 92.94%. Comparing base (6a30f74) to head (60d9b72).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #4979   +/-   ##
=======================================
  Coverage   92.94%   92.94%           
=======================================
  Files         110      110           
  Lines       35767    35767           
=======================================
+ Hits        33244    33245    +1     
+ Misses       2523     2522    -1     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown
Member

@mcollina mcollina left a comment

Choose a reason for hiding this comment

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

lgtm

@metcoder95 metcoder95 merged commit 95b9c75 into nodejs:main Apr 7, 2026
35 checks passed
@trivikr trivikr deleted the object-has-own branch April 8, 2026 03:41
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.

4 participants