Line 190: |
Line 190: |
| | | |
| console.log("Within partition: " + ect ); | | console.log("Within partition: " + ect ); |
− | if ( Array.isArray( moving ) ){ | + | future_temp_obj.push( checkdive( temp_obj[ ect ], 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 218: |
Line 200: |
| | | |
| 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 250: |
Line 215: |
| | | |
| function checkdive( array, read){ | | function checkdive( array, read){ |
− | if ( ( array !== undefined ) && ( read !== undefined ) ) { | + | if ( check(array, read) !== undefined) { |
− | if ( check(array, read) !== undefined) {
| + | return dive(array, read); |
− | return dive(array, read);
| + | } else if ( Array.isArray(array) ) { |
− | } else if ( Array.isArray(array) ) {
| + | var potential_return = []; |
− | var potential_return = [];
| + | Object.keys(array).forEach( function(item){ |
− | Object.keys(array).forEach( function(item){
| + | if ( check(array[item], read) !== undefined ) { |
− | if ( check(array[item], read) !== undefined ) {
| + | potential_return.push( dive( array[item], read) ); |
− | potential_return.push( dive( array[item], read) );
| + | } |
− | }
| + | }); |
− | });
| + | return potential_return; |
− | return potential_return;
| + | } |
− | }
| + | if ( array === read ) { |
− | if ( array === read ) {
| + | return read; |
− | return read;
| + | } |
− | }
| + | if (Object.keys( array ).length > 0 ){ |
− | if (Object.keys( array ).length > 0 ){
| + | Object.keys( array ).forEach( function ( piece ) { |
− | Object.keys( array ).forEach( function ( piece ) {
| + | if ( array[ piece ] === read ) { return read }; |
− | if ( array[ piece ] === read ) { return read };
| + | }); |
− | });
| |
− | }
| |
| } | | } |
| } | | } |