libraries/tracking-core/helpers/formatHelpers.js
function checkPathSegment(currentData, currentPathSegmentIndex) {
    // Get the current segment within the path
    const currentPathSegment = pathSegments[currentPathSegmentIndex];
    const nextPathSegmentIndex = currentPathSegmentIndex + 1;

    /**
     * Prepare the default value as return value for the case that no matching property was
     * found for the current path segment. In that case the path must be wrong.
     */
    let result = defaultReturnValue;

    if (currentData && currentData.hasOwnProperty(currentPathSegment)) {
      if (
        typeof currentData[currentPathSegment] !== 'object' ||
        pathSegments.length === nextPathSegmentIndex
      ) {
        // A final value was found
        result = currentData[currentPathSegment];
      } else {
        // The value at the current step within the path is another object. Traverse through it
        result = checkPathSegment(currentData[currentPathSegment], nextPathSegmentIndex);
      }
    }

    return result;
  }
function checkPathSegment(currentData, currentPathSegmentIndex) {
    // Get the current segment within the path
    const currentPathSegment = pathSegments[currentPathSegmentIndex];
    const nextPathSegmentIndex = currentPathSegmentIndex + 1;

    /**
     * Prepare the default value as return value for the case that no matching property was
     * found for the current path segment. In that case the path must be wrong.
     */
    let result = defaultReturnValue;

    if (currentData && currentData.hasOwnProperty(currentPathSegment)) {
      if (
        typeof currentData[currentPathSegment] !== 'object' ||
        pathSegments.length === nextPathSegmentIndex
      ) {
        // A final value was found
        result = currentData[currentPathSegment];
      } else {
        // The value at the current step within the path is another object. Traverse through it
        result = checkPathSegment(currentData[currentPathSegment], nextPathSegmentIndex);
      }
    }

    return result;
  }
function checkPathSegment ( currentData , currentPathSegmentIndex ) { // Get the current segment within the path const currentPathSegment = pathSegments [ currentPathSegmentIndex ] ; const nextPathSegmentIndex = currentPathSegmentIndex + 1 ; /**
     * Prepare the default value as return value for the case that no matching property was
     * found for the current path segment. In that case the path must be wrong.
     */ let result = defaultReturnValue ; if ( currentData && currentData . hasOwnProperty ( currentPathSegment ) ) { if ( typeof currentData [ currentPathSegment ] !== 'object' || pathSegments . length === nextPathSegmentIndex ) { // A final value was found result = currentData [ currentPathSegment ] ; } else { // The value at the current step within the path is another object. Traverse through it result = checkPathSegment ( currentData [ currentPathSegment ] , nextPathSegmentIndex ) ; } } return result ; }
Recursive callable function to traverse through a complex object

@param {Object} currentData The current data that shall be investigated
@param {number} currentPathSegmentIndex The current index within the path segment list
@returns {*} The value at the end of the path or the default one
Recursive callable function to traverse through a complex object