function formatNonEmptyArray()

in src/helpers/whatif.ts [688:724]


function formatNonEmptyArray(
  builder: ColorStringBuilder,
  value: UnknownValue[],
  indentLevel: number,
): void {
  builder.append(Symbol.LeftSquareBracket, Color.Reset).appendLine();

  const maxPathLength = getMaxPathLengthFromArray(value);

  value.forEach((childValue, index) => {
    const childPath = String(index);

    if (isNonEmptyObject(childValue)) {
      formatJsonPath(builder, childPath, 0, indentLevel + 1);
      formatNonEmptyObject(
        builder,
        childValue,
        undefined,
        undefined,
        indentLevel + 1,
      );
    } else {
      formatJsonValue(
        builder,
        childValue,
        childPath,
        maxPathLength,
        indentLevel + 1,
      );
    }

    builder.appendLine();
  });

  formatIndent(builder, indentLevel);
  builder.append(Symbol.RightSquareBracket, Color.Reset);
}