@@ -2057,23 +2057,23 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfi
20572057 }
20582058 if ( Lib . isPlainObject ( d ) ) {
20592059 var o = { } ;
2060- var v , src ;
2061- for ( v in d ) {
2060+ var src ;
2061+ Object . keys ( d ) . sort ( ) . forEach ( function ( v ) {
20622062 // remove private elements and functions
20632063 // _ is for private, [ is a mistake ie [object Object]
2064- if ( [ '_' , '[' ] . indexOf ( v . charAt ( 0 ) ) !== - 1 ) continue ;
2064+ if ( [ '_' , '[' ] . indexOf ( v . charAt ( 0 ) ) !== - 1 ) return ;
20652065
20662066 // if a function, add if necessary then move on
20672067 if ( typeof d [ v ] === 'function' ) {
20682068 if ( keepFunction ) o [ v ] = '_function' ;
2069- continue ;
2069+ return ;
20702070 }
20712071
20722072 // look for src/data matches and remove the appropriate one
20732073 if ( mode === 'keepdata' ) {
20742074 // keepdata: remove all ...src tags
20752075 if ( v . substr ( v . length - 3 ) === 'src' ) {
2076- continue ;
2076+ return ;
20772077 }
20782078 } else if ( mode === 'keepstream' ) {
20792079 // keep sourced data if it's being streamed.
@@ -2082,21 +2082,21 @@ plots.graphJson = function(gd, dataonly, mode, output, useDefaults, includeConfi
20822082 src = d [ v + 'src' ] ;
20832083 if ( typeof src === 'string' && src . indexOf ( ':' ) > 0 ) {
20842084 if ( ! Lib . isPlainObject ( d . stream ) ) {
2085- continue ;
2085+ return ;
20862086 }
20872087 }
20882088 } else if ( mode !== 'keepall' ) {
20892089 // keepref: remove sourced data but only
20902090 // if the source tag is well-formed
20912091 src = d [ v + 'src' ] ;
20922092 if ( typeof src === 'string' && src . indexOf ( ':' ) > 0 ) {
2093- continue ;
2093+ return ;
20942094 }
20952095 }
20962096
20972097 // OK, we're including this... recurse into it
20982098 o [ v ] = stripObj ( d [ v ] , keepFunction ) ;
2099- }
2099+ } ) ;
21002100 return o ;
21012101 }
21022102
0 commit comments