@@ -27,6 +27,9 @@ var editTypes = require('./edit_types');
27
27
var extendFlat = Lib . extendFlat ;
28
28
var extendDeepAll = Lib . extendDeepAll ;
29
29
var isPlainObject = Lib . isPlainObject ;
30
+ var isArrayOrTypedArray = Lib . isArrayOrTypedArray ;
31
+ var nestedProperty = Lib . nestedProperty ;
32
+ var valObjectMeta = Lib . valObjectMeta ;
30
33
31
34
var IS_SUBPLOT_OBJ = '_isSubplotObj' ;
32
35
var IS_LINKED_TO_ARRAY = '_isLinkedToArray' ;
@@ -65,7 +68,7 @@ exports.get = function() {
65
68
66
69
return {
67
70
defs : {
68
- valObjects : Lib . valObjectMeta ,
71
+ valObjects : valObjectMeta ,
69
72
metaKeys : UNDERSCORE_ATTRS . concat ( [ 'description' , 'role' , 'editType' , 'impliedEdits' ] ) ,
70
73
editType : {
71
74
traces : editTypes . traces ,
@@ -204,19 +207,19 @@ exports.findArrayAttributes = function(trace) {
204
207
var item = container [ stack [ i ] ] ;
205
208
var newAstrPartial = astrPartial + stack [ i ] ;
206
209
if ( i === stack . length - 1 ) {
207
- if ( Lib . isArrayOrTypedArray ( item ) ) {
210
+ if ( isArrayOrTypedArray ( item ) ) {
208
211
arrayAttributes . push ( baseAttrName + newAstrPartial ) ;
209
212
}
210
213
} else {
211
214
if ( isArrayStack [ i ] ) {
212
215
if ( Array . isArray ( item ) ) {
213
216
for ( var j = 0 ; j < item . length ; j ++ ) {
214
- if ( Lib . isPlainObject ( item [ j ] ) ) {
217
+ if ( isPlainObject ( item [ j ] ) ) {
215
218
crawlIntoTrace ( item [ j ] , i + 1 , newAstrPartial + '[' + j + '].' ) ;
216
219
}
217
220
}
218
221
}
219
- } else if ( Lib . isPlainObject ( item ) ) {
222
+ } else if ( isPlainObject ( item ) ) {
220
223
crawlIntoTrace ( item , i + 1 , newAstrPartial + '.' ) ;
221
224
}
222
225
}
@@ -463,9 +466,9 @@ function getTraceAttributes(type) {
463
466
464
467
// prune global-level trace attributes that are already defined in a trace
465
468
exports . crawl ( copyModuleAttributes , function ( attr , attrName , attrs , level , fullAttrString ) {
466
- Lib . nestedProperty ( copyBaseAttributes , fullAttrString ) . set ( undefined ) ;
469
+ nestedProperty ( copyBaseAttributes , fullAttrString ) . set ( undefined ) ;
467
470
// Prune undefined attributes
468
- if ( attr === undefined ) Lib . nestedProperty ( copyModuleAttributes , fullAttrString ) . set ( undefined ) ;
471
+ if ( attr === undefined ) nestedProperty ( copyModuleAttributes , fullAttrString ) . set ( undefined ) ;
469
472
} ) ;
470
473
471
474
// base attributes (same for all trace types)
@@ -597,7 +600,7 @@ function getTransformAttributes(type) {
597
600
598
601
function getFramesAttributes ( ) {
599
602
var attrs = {
600
- frames : Lib . extendDeepAll ( { } , frameAttributes )
603
+ frames : extendDeepAll ( { } , frameAttributes )
601
604
} ;
602
605
603
606
formatAttributes ( attrs ) ;
@@ -699,15 +702,15 @@ function assignPolarLayoutAttrs(layoutAttributes) {
699
702
}
700
703
701
704
function handleBasePlotModule ( layoutAttributes , _module , astr ) {
702
- var np = Lib . nestedProperty ( layoutAttributes , astr ) ;
705
+ var np = nestedProperty ( layoutAttributes , astr ) ;
703
706
var attrs = extendDeepAll ( { } , _module . layoutAttributes ) ;
704
707
705
708
attrs [ IS_SUBPLOT_OBJ ] = true ;
706
709
np . set ( attrs ) ;
707
710
}
708
711
709
712
function insertAttrs ( baseAttrs , newAttrs , astr ) {
710
- var np = Lib . nestedProperty ( baseAttrs , astr ) ;
713
+ var np = nestedProperty ( baseAttrs , astr ) ;
711
714
712
715
np . set ( extendDeepAll ( np . get ( ) || { } , newAttrs ) ) ;
713
716
}
0 commit comments