styled-components / styled-components

Visual primitives for the component age. Use the best bits of ES6 and CSS to style your apps without stress 💅
https://styled-components.com
MIT License
40.12k stars 2.48k forks source link

Update flatten.ts #4282

Open iegik opened 1 month ago

iegik commented 1 month ago

To avoid situation where provided object do not have prototype we should use Object.hasOwn.

Test1:

objToCssArray(Object.create(null))

Test2:

const obj = Object.create(null);
obj.color = 'red';
objToCssArray(obj)

Test3:

const obj = {
  hasOwnProperty: () => { /*...*/ return true },
}
objToCssArray(obj)
quantizor commented 1 week ago

This change unfortunately regresses hot path performance by a decent amount Screenshot 2024-04-30 at 5 35 35 PM