function getMaxPathLengthFromObject()

in src/helpers/whatif.ts [817:835]


function getMaxPathLengthFromObject(
  value: Record<string, UnknownValue>,
): number {
  let maxPathLength = 0;

  for (const [key, childValue] of entries(value)) {
    if (isNonEmptyArray(childValue)) {
      continue; // Ignore array paths
    }

    const currentPathLength = isNonEmptyObject(childValue)
      ? key.length + 1 + getMaxPathLengthFromObject(childValue)
      : key.length;

    maxPathLength = Math.max(maxPathLength, currentPathLength);
  }

  return maxPathLength;
}