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, previousObjKey, objectNestLevel)
            {      
              if(address[objKey][objKey + "0"])
              { 
                for (let property in address[objKey][objKey + "0"])
                {
                  if(address[objKey][objKey + "0"][property][property + "0"])
                  {
                    drillIntoObject(address[objKey][objKey + "0"], property, objKey, objectNestLevel + 1);
                  }
                  else 
                  { 
                    let objectPath = objKey + "." + objKey + "0." + property;
                    objectPath = previousObjKey.length === 0 ? objectPath : previousObjKey + "." + objectPath;
                    if(address[objKey][objKey + "0"][property].unique === "yes")
                    {
                      uniqueFieldsArray.push(objectPath);   
                    } 
                  } 
                } 
              } 
            }
function drillIntoObject ( address , objKey , previousObjKey , objectNestLevel ) { if ( address [ objKey ] [ objKey + "0" ] ) { for ( let property in address [ objKey ] [ objKey + "0" ] ) { if ( address [ objKey ] [ objKey + "0" ] [ property ] [ property + "0" ] ) { drillIntoObject ( address [ objKey ] [ objKey + "0" ] , property , objKey , objectNestLevel + 1 ) ; } else { let objectPath = objKey + "." + objKey + "0." + property ; objectPath = previousObjKey . length === 0 ? objectPath : previousObjKey + "." + objectPath ; if ( address [ objKey ] [ objKey + "0" ] [ property ] . unique === "yes" ) { uniqueFieldsArray . push ( objectPath ) ; } } } } }
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. // 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. // Assemble the path through the current object to the current data field. // If the current object is nested then prepend the path to include the parent objects. // Check if the current field has a unique constraint. // 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. // End of: if the subfield is also an object