benjamine / jsondiffpatch

Diff & patch JavaScript objects
MIT License
4.77k stars 464 forks source link

Feature: Omit unchanged lines over threshold in console formatter #347

Open mike-vermillio opened 10 months ago

mike-vermillio commented 10 months ago

Adding a feature to omit repeated unchanged lines for console formatter.

I'm wanted a way to omit large groups of unchanged lines to help keep the output concise when working with large json objects.

Also as a side effect the colors are customizable with this PR (so I could sort of reasonably verify the formatting in a test).

See test for an example, but a json object with 1000+ fields largely unchanged would look something like:

    {
      bar: "bar"
      baz: "baz" => "foo"
      baz000: "baz000"
      baz001: "baz001"
      baz002: "baz002"
      baz003: "baz003"
      ... omitted 996 unchanged fields
      foo: "foo" => "baz"
    }

where the ... omitted 996 unchanged fields is formatted with the unchanged color.