@@ -698,10 +698,12 @@ lib.getTargetArray = function(trace, transformOpts) {
698
698
* because extend-like algorithms are hella slow
699
699
* obj2 is assumed to already be clean of these things (including no arrays)
700
700
*/
701
- lib . minExtend = function ( obj1 , obj2 , isPie ) {
701
+ function minExtend ( obj1 , obj2 , opt ) {
702
702
var objOut = { } ;
703
703
if ( typeof obj2 !== 'object' ) obj2 = { } ;
704
- var arrayLen = isPie = 3 ;
704
+
705
+ var arrayLen = opt === 'pieLike' ? - 1 : 3 ;
706
+
705
707
var keys = Object . keys ( obj1 ) ;
706
708
var i , k , v ;
707
709
@@ -711,14 +713,18 @@ lib.minExtend = function(obj1, obj2, isPie) {
711
713
if ( k . charAt ( 0 ) === '_' || typeof v === 'function' ) continue ;
712
714
else if ( k === 'module' ) objOut [ k ] = v ;
713
715
else if ( Array . isArray ( v ) ) {
714
- if ( isPie || k === 'colorscale' ) {
716
+ if ( k === 'colorscale' || arrayLen === - 1 ) {
715
717
objOut [ k ] = v . slice ( ) ;
716
718
} else {
717
719
objOut [ k ] = v . slice ( 0 , arrayLen ) ;
718
720
}
719
721
} else if ( lib . isTypedArray ( v ) ) {
720
- objOut [ k ] = v . subarray ( 0 , arrayLen ) ;
721
- } else if ( v && ( typeof v === 'object' ) ) objOut [ k ] = lib . minExtend ( obj1 [ k ] , obj2 [ k ] ) ;
722
+ if ( arrayLen === - 1 ) {
723
+ objOut [ k ] = v . subarray ( ) ;
724
+ } else {
725
+ objOut [ k ] = v . subarray ( 0 , arrayLen ) ;
726
+ }
727
+ } else if ( v && ( typeof v === 'object' ) ) objOut [ k ] = minExtend ( obj1 [ k ] , obj2 [ k ] , opt ) ;
722
728
else objOut [ k ] = v ;
723
729
}
724
730
@@ -732,7 +738,8 @@ lib.minExtend = function(obj1, obj2, isPie) {
732
738
}
733
739
734
740
return objOut ;
735
- } ;
741
+ }
742
+ lib . minExtend = minExtend ;
736
743
737
744
lib . titleCase = function ( s ) {
738
745
return s . charAt ( 0 ) . toUpperCase ( ) + s . substr ( 1 ) ;
0 commit comments