perf: use Object.hasOwn()
instead of in
when checking in the prototype chain isn't required
#7217
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.
Milestone
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 usingObject.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
The text was updated successfully, but these errors were encountered: