lib/z_Original_Working_meta.js
// Declare a function that we will use to drill into the object.
Declare a function that we will use to drill into the object.
Declare a function that we will use to drill into the object .
function drillIntoObject(address, objKey, objectNestLevel, previousPath)
            { 
              if(address[objKey][objKey + "0"])
              { 
                if(objectNestLevelHistory === objectNestLevel)
                {
                  if(objectNestLevel === 1)
                  {
                    htmlString = htmlString + "\n";    
                  }
                  objectNestLevelHistory = objectNestLevelHistory + 1;
                } 
                for (let property in address[objKey][objKey + "0"])
                {
                  if(address[objKey][objKey + "0"][property][property + "0"])
                  {
                    drillIntoObject(address[objKey][objKey + "0"], property, objectNestLevel + 1, previousPath + objKey + "_" + objKey + "0_");
                  }
                  else 
                  { 
                    htmlString = htmlString +
                    "    " + "// Add any fields named \"" + property + "Array\" to the object we will write to the database." + "\n" +
                    "    " + recordObject.tableName + "Object = buildBranches(" + property + "Array, " + recordObject.tableName + "Object);" + "\n\n";    
                  } 
                } 
                objectNestLevelHistory = objectNestLevelHistory -1;   
              } 
            }
function drillIntoObject ( address , objKey , objectNestLevel , previousPath ) { if ( address [ objKey ] [ objKey + "0" ] ) { if ( objectNestLevelHistory === objectNestLevel ) { if ( objectNestLevel === 1 ) { htmlString = htmlString + "\n" ; } objectNestLevelHistory = objectNestLevelHistory + 1 ; } for ( let property in address [ objKey ] [ objKey + "0" ] ) { if ( address [ objKey ] [ objKey + "0" ] [ property ] [ property + "0" ] ) { drillIntoObject ( address [ objKey ] [ objKey + "0" ] , property , objectNestLevel + 1 , previousPath + objKey + "_" + objKey + "0_" ) ; } else { htmlString = htmlString + "    " + "// Add any fields named \"" + property + "Array\" to the object we will write to the database." + "\n" + "    " + recordObject . tableName + "Object = buildBranches(" + property + "Array, " + recordObject . tableName + "Object);" + "\n\n" ; } } objectNestLevelHistory = objectNestLevelHistory - 1 ; } }
Declare a function that we will use to drill into the object.
Declare a function that we will use to drill into the object .
// if the subfield is also an object then this function calls itself using the subfield parameters. // This will continue drilling in until we are at the end of the branches // If this is the first time we were this deep in the object on this branch. // Keeping track of how many levels deep we have already drilled. // This is so we don't overwrite code that has already been generated. // End of: if(objectNestLevelHistory === objectNestLevel){...} // Check each property of the subobject to see if it too is an object. // If the property is also an object // This function calls itself so as to go deeper into the object // This property is not an object. We are at the end of the branch where we encounter a data field. // End of: else - This property is not an object. // End of: for-let Check each property of the subobject to see if it too is an object. // Noting that we are moving back up the object tree. // End of: if the subfield is also an object