File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ ---
2+ ' css-to-react-native ' : patch
3+ ---
4+
5+ Refactor transform to avoid accumulator-based object merging.
Original file line number Diff line number Diff line change @@ -105,15 +105,20 @@ export const getPropertyName = (propName: string): string => {
105105const transform = (
106106 rules : StyleTuple [ ] ,
107107 shorthandBlacklist : string [ ] = [ ]
108- ) : Style =>
109- rules . reduce < Style > ( ( accum , rule ) => {
108+ ) : Style => {
109+ const result : Style = { }
110+
111+ for ( const rule of rules ) {
110112 const propertyName = getPropertyName ( rule [ 0 ] )
111113 const value = rule [ 1 ]
112114 const allowShorthand = shorthandBlacklist . indexOf ( propertyName ) === - 1
113- return Object . assign (
114- accum ,
115+ Object . assign (
116+ result ,
115117 getStylesForProperty ( propertyName , value , allowShorthand )
116118 )
117- } , { } )
119+ }
120+
121+ return result
122+ }
118123
119124export default transform
You can’t perform that action at this time.
0 commit comments