Line 131: |
Line 131: |
| if ( sqitch === "update record" ) { // Record Update | | if ( sqitch === "update record" ) { // Record Update |
| if ( control_1 != undefined ) { | | if ( control_1 != undefined ) { |
| + | inp_obj[ control_1 ] = inp_obj[ control_1 ] || (isNaN( control_2 )) ? {} : []; |
| if ( control_2 != undefined ) { | | if ( control_2 != undefined ) { |
| + | inp_obj[ control_1 ][ control_2 ] = inp_obj[ control_1 ][ control_2 ] || []; |
| if ( control_3 != undefined ) { | | if ( control_3 != undefined ) { |
− |
| |
| if ( Array.isArray( inp_obj[ control_1 ][ control_2 ] ) ) { | | if ( Array.isArray( inp_obj[ control_1 ][ control_2 ] ) ) { |
| inp_obj[ control_1 ][ control_2 ].push( control_3 ); | | inp_obj[ control_1 ][ control_2 ].push( control_3 ); |
Line 169: |
Line 170: |
| | | |
| }; | | }; |
| + | |
| + | if ( sqitch === "remove from record" ) { // Record Update |
| + | if ( control_1 != undefined ) { |
| + | if ( control_2 != undefined ) { |
| + | if ( Array.isArray( inp_obj[ control_1 ] ) ) { |
| + | inp_obj[ control_1 ].splice( control_2, 1 ); |
| + | } else { |
| + | delete inp_obj[ control_1 ][ control_2 ]; |
| + | } |
| + | } else { |
| + | delete inp_obj[ control_1 ]; |
| + | } |
| + | } |
| + | } |
| + | |
| console.log("return 2") | | console.log("return 2") |
| resolve( inp_obj ); | | resolve( inp_obj ); |