function formatPropertyArrayChange()

in src/helpers/whatif.ts [555:581]


function formatPropertyArrayChange(
  builder: ColorStringBuilder,
  parentPropertyChange: WhatIfPropertyChange,
  propertyChanges: WhatIfPropertyChange[],
  indentLevel: number,
): void {
  if (!parentPropertyChange.path) {
    // The parent change doesn't have a path, which means the current
    // array change is a nested change. Decrease indent level.
    indentLevel -= 1;
    formatIndent(builder, indentLevel);
  }

  if (!propertyChanges || propertyChanges.length === 0) {
    builder.appendLine("[]");
    return;
  }

  // [
  builder.append(Symbol.LeftSquareBracket).appendLine();

  formatPropertyChanges(builder, sortChanges(propertyChanges), indentLevel);

  // ]
  formatIndent(builder, indentLevel);
  builder.append(Symbol.RightSquareBracket);
}