@@ -72,8 +72,6 @@ exports.supplyDefaults = function(transformIn) {
72
72
coerce ( 'groups' ) ;
73
73
coerce ( 'style' ) ;
74
74
75
- // or some more complex logic using fullData and layout
76
-
77
75
return transformOut ;
78
76
} ;
79
77
@@ -94,15 +92,11 @@ exports.supplyDefaults = function(transformIn) {
94
92
* array of transformed traces
95
93
*/
96
94
exports . transform = function ( data , state ) {
97
-
98
- // one-to-many case
99
-
100
95
var newData = [ ] ;
101
96
102
- data . forEach ( function ( trace , i ) {
103
-
104
- newData = newData . concat ( transformOne ( trace , state , state . attributeSets [ i ] ) ) ;
105
- } ) ;
97
+ for ( var i = 0 ; i < data . length ; i ++ ) {
98
+ newData = newData . concat ( transformOne ( data [ i ] , state ) ) ;
99
+ }
106
100
107
101
return newData ;
108
102
} ;
@@ -141,9 +135,7 @@ function transformOne(trace, state) {
141
135
for ( var i = 0 ; i < groupNames . length ; i ++ ) {
142
136
var groupName = groupNames [ i ] ;
143
137
144
- // TODO is this the best pattern ???
145
- // maybe we could abstract this out
146
- var newTrace = newData [ i ] = Lib . extendDeep ( { } , trace ) ;
138
+ var newTrace = newData [ i ] = Lib . extendDeepNoArrays ( { } , trace ) ;
147
139
148
140
arrayAttrs . forEach ( initializeArray . bind ( null , newTrace ) ) ;
149
141
@@ -155,9 +147,9 @@ function transformOne(trace, state) {
155
147
156
148
newTrace . name = groupName ;
157
149
158
- // there's no need to coerce style[groupName] here
150
+ // there's no need to coerce style[groupName] here
159
151
// as another round of supplyDefaults is done on the transformed traces
160
- newTrace = Lib . extendDeep ( newTrace , style [ groupName ] || { } ) ;
152
+ newTrace = Lib . extendDeepNoArrays ( newTrace , style [ groupName ] || { } ) ;
161
153
}
162
154
163
155
return newData ;
0 commit comments