@@ -98,36 +98,16 @@ exports.transform = function(data, state) {
9898 return newData ;
9999} ;
100100
101- function getDeepProp ( thing , propArray ) {
102- var result = thing ;
103- var i ;
104- for ( i = 0 ; i < propArray . length ; i ++ ) {
105- result = result [ propArray [ i ] ] ;
106- if ( result === void ( 0 ) ) {
107- return result ;
108- }
109- }
110- return result ;
111- }
112-
113- function setDeepProp ( thing , propArray , value ) {
114- var current = thing ;
115- var i ;
116- for ( i = 0 ; i < propArray . length - 1 ; i ++ ) {
117- if ( current [ propArray [ i ] ] === void ( 0 ) ) {
118- current [ propArray [ i ] ] = { } ;
119- }
120- current = current [ propArray [ i ] ] ;
121- }
122- current [ propArray [ propArray . length - 1 ] ] = value ;
123- }
124-
125101function initializeArray ( newTrace , a ) {
126- setDeepProp ( newTrace , a , [ ] ) ;
102+ Lib . nestedProperty ( newTrace , a ) . set ( [ ] ) ;
127103}
128104
129105function pasteArray ( newTrace , trace , j , a ) {
130- getDeepProp ( newTrace , a ) . push ( getDeepProp ( trace , a ) [ j ] ) ;
106+ Lib . nestedProperty ( newTrace , a ) . set (
107+ Lib . nestedProperty ( newTrace , a ) . get ( ) . concat ( [
108+ Lib . nestedProperty ( trace , a ) . get ( ) [ j ]
109+ ] )
110+ ) ;
131111}
132112
133113function transformOne ( trace , state , attributeSet ) {
@@ -149,7 +129,7 @@ function transformOne(trace, state, attributeSet) {
149129 var style = opts . style || { } ;
150130
151131 var arrayAttributes = attributeSet
152- . filter ( function ( array ) { return Array . isArray ( getDeepProp ( trace , array ) ) ; } ) ;
132+ . filter ( function ( array ) { return Array . isArray ( Lib . nestedProperty ( trace , array ) . get ( ) ) ; } ) ;
153133
154134 // fixme the O(n**3) complexity
155135 for ( var i = 0 ; i < groupNames . length ; i ++ ) {
0 commit comments