Line 190: |
Line 190: |
| | | |
| console.log("Within partition: " + ect ); | | console.log("Within partition: " + ect ); |
− | future_temp_obj.push( checkdive( temp_obj[ ect ], moving ) ); | + | if ( Array.isArray( moving ) ){ |
| + | |
| + | var move_holder = temp_obj[ect]; |
| + | Object.keys( moving ).forEach( function( move ) { |
| + | move_holder = checkdive( move_holder, move ); |
| + | }); |
| + | if ( move_holder !== undefined ) { |
| + | future_temp_obj.push( move_holder ); |
| + | } |
| | | |
| + | } else { |
| + | |
| + | future_temp_obj.push( checkdive( temp_obj[ ect ], moving ) ); |
| + | |
| + | } |
| }); | | }); |
− | temp_obj = future_temp_obj; | + | |
| + | if ( future_temp_obj !== undefined ){ |
| + | temp_obj = future_temp_obj; |
| + | } else { |
| + | console.log('nothing to see here') |
| + | } |
| | | |
| } else { | | } else { |
Line 200: |
Line 218: |
| | | |
| console.log("data is on an objective level"); | | console.log("data is on an objective level"); |
− | future_temp_obj = checkdive( temp_obj, moving ); | + | |
| + | if ( Array.isArray( moving ) ){ |
| + | |
| + | var move_holder = temp_obj; |
| + | |
| + | Object.keys( moving ).forEach( function( move ) { |
| + | move_holder = checkdive( move_holder, move ); |
| + | }); |
| + | if ( move_holder !== undefined ) { |
| + | future_temp_obj.push( move_holder ); |
| + | } |
| + | |
| + | } else { |
| + | |
| + | future_temp_obj.push( checkdive( temp_obj, moving ) ); |
| + | |
| + | } |
| + | |
| if ( future_temp_obj !== undefined ){ | | if ( future_temp_obj !== undefined ){ |
| temp_obj = future_temp_obj; | | temp_obj = future_temp_obj; |
Line 215: |
Line 250: |
| | | |
| function checkdive( array, read){ | | function checkdive( array, read){ |
− | if ( check(array, read) !== undefined) { | + | if ( ( array !== undefined ) && ( read !== undefined ) ) { |
− | return dive(array, read);
| + | if ( check(array, read) !== undefined) { |
− | } else if ( Array.isArray(array) ) {
| + | return dive(array, read); |
− | var potential_return = [];
| + | } else if ( Array.isArray(array) ) { |
− | Object.keys(array).forEach( function(item){
| + | var potential_return = []; |
− | if ( check(array[item], read) !== undefined ) {
| + | Object.keys(array).forEach( function(item){ |
− | potential_return.push( dive( array[item], read) );
| + | if ( check(array[item], read) !== undefined ) { |
− | }
| + | potential_return.push( dive( array[item], read) ); |
− | });
| + | } |
− | return potential_return;
| + | }); |
− | }
| + | return potential_return; |
− | if ( array === read ) {
| + | } |
− | return read;
| + | if ( array === read ) { |
− | }
| + | return read; |
− | if (Object.keys( array ).length > 0 ){
| + | } |
− | Object.keys( array ).forEach( function ( piece ) {
| + | if (Object.keys( array ).length > 0 ){ |
− | if ( array[ piece ] === read ) { return read };
| + | Object.keys( array ).forEach( function ( piece ) { |
− | });
| + | if ( array[ piece ] === read ) { return read }; |
| + | }); |
| + | } |
| } | | } |
| } | | } |