Skip to content

refactor: Use object.prototype to check for reserved properties#5670

Merged
lukastaegert merged 1 commit intorollup:masterfrom
YuHyeonWook:fix/Modifying_Logic
Sep 21, 2024
Merged

refactor: Use object.prototype to check for reserved properties#5670
lukastaegert merged 1 commit intorollup:masterfrom
YuHyeonWook:fix/Modifying_Logic

Conversation

@YuHyeonWook
Copy link
Contributor

This PR contains:

  • bugfix
  • feature
  • refactor
  • documentation
  • other

Are tests included?

  • yes (bugfixes and features will not be merged without tests)
  • no

Breaking Changes?

  • yes (breaking changes will not be merged unless absolutely necessary)
  • no

List any relevant issue numbers:

Description:

This PR includes the following improvements:

  1. Refactoring the use of the in operator: Replaced the use of the in operator on an empty object {} with Object.prototype to properly check if parts[0] is a property of JavaScript's built-in objects. The previous approach always returned false, making the check ineffective.

  2. Optimization of null assignment logic: When isReserved is true, assigning null to parts[0] was unnecessary. Instead, parts[0] is now retained to avoid redundant null assignments and improve the overall logic.

@vercel
Copy link

vercel bot commented Sep 21, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
rollup ✅ Ready (Inspect) Visit Preview 💬 Add feedback Sep 21, 2024 2:00am

@codecov
Copy link

codecov bot commented Sep 21, 2024

Codecov Report

Attention: Patch coverage is 83.33333% with 1 line in your changes missing coverage. Please review.

Project coverage is 99.39%. Comparing base (b86ffd7) to head (182b6a6).
Report is 3 commits behind head on master.

Files with missing lines Patch % Lines
src/finalisers/shared/setupNamespace.ts 83.33% 0 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master    #5670   +/-   ##
=======================================
  Coverage   99.39%   99.39%           
=======================================
  Files         242      242           
  Lines        9346     9348    +2     
  Branches     2470     2472    +2     
=======================================
+ Hits         9289     9291    +2     
  Misses         48       48           
  Partials        9        9           

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

@lukastaegert lukastaegert merged commit 10ab90e into rollup:master Sep 21, 2024
@github-actions
Copy link

This PR has been released as part of rollup@4.22.4. You can test it via npm install rollup.

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