Fix accumulating spread in transform function#211
Fix accumulating spread in transform function#211jacobp100 merged 1 commit intostyled-components:masterfrom
Conversation
|
There was a problem hiding this comment.
Pull request overview
This PR updates the core transform implementation (default export) that converts an array of CSS-style tuples into a React Native style object, with the stated goal of improving accumulator performance.
Changes:
- Replaced the
Array.reduce-based accumulator with an explicitfor...ofloop and a preallocatedresultobject. - Preserved the existing per-rule merge behavior via
Object.assigninto the accumulator object.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Spread syntax should be avoided on accumulators (like those in `.reduce`) because it causes a time complexity of `O(n^2)`.
c07bc9f to
9b6ae6d
Compare
|
@wojtekmaj If you know anybody in SC that's got permissions to add you as a contributor to this repo, I'd be happy for you to be added. Unfortunately I only have permission to approve & merge PRs |
Spread syntax should be avoided on accumulators (like those in
.reduce) because it causes a time complexity ofO(n^2).