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

perf: use Object.hasOwn() instead of in when checking in the prototype chain isn't required #7217

Open
benelan opened this issue Jun 23, 2023 · 0 comments
Labels
0 - new New issues that need assignment. estimate - 2 Small fix or update, may require updates to tests. p - low Issue is non core or affecting less that 10% of people using the library refactor Issues tied to code that needs to be significantly reworked.

Comments

@benelan
Copy link
Member

benelan commented Jun 23, 2023

Description

The in operator checks an object and its prototype chain for a specified property. In most cases, we likely don't care about the object's inherited properties, so we can switch to using Object.hasOwn().

Proposed Advantages

It will improve performance by not checking an object's entire prototype chain for a specified property.

Which Component

All components and utils that use in when it isn't necessary.

Relevant Info

Relevant issue: #7178

@benelan benelan added refactor Issues tied to code that needs to be significantly reworked. 0 - new New issues that need assignment. needs triage Planning workflow - pending design/dev review. labels Jun 23, 2023
@geospatialem geospatialem added p - low Issue is non core or affecting less that 10% of people using the library estimate - 2 Small fix or update, may require updates to tests. needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. and removed needs triage Planning workflow - pending design/dev review. labels May 28, 2024
@DitwanP DitwanP removed the needs milestone Planning workflow - pending milestone assignment, has priority and/or estimate. label Jan 3, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0 - new New issues that need assignment. estimate - 2 Small fix or update, may require updates to tests. p - low Issue is non core or affecting less that 10% of people using the library refactor Issues tied to code that needs to be significantly reworked.
Projects
None yet
Development

No branches or pull requests

3 participants