deep-object-diff icon indicating copy to clipboard operation
deep-object-diff copied to clipboard

Arrays returned as objects

Open StephenTHendrix opened this issue 2 years ago • 6 comments

I think I'm just re-reporting https://github.com/mattphillips/deep-object-diff/issues/79.

diff({ test: [] }, { test: ['apple'] }) returns { test: { 0: 'apple' }

StephenTHendrix avatar Mar 28 '23 16:03 StephenTHendrix

Same for me

obrunopolo avatar Apr 27 '23 15:04 obrunopolo

same for me, is there a fix anyone found or should i find a different package? actually should even be ability to say ignoreArrays:true to just get the new array instead of each index which doesnt really matter to alot of people..

mikila85 avatar Aug 18 '23 21:08 mikila85

It seems that this here doesn't work at all:

  diff(
    {
      v: {
        data: [
          {
            blabla: 3,
          },
        ],
      },
    },
    {
      v: {
        data: [
          {},
        ],
      },
    },
  ),

Returns:

[Object: null prototype] {
  v: [Object: null prototype] {
    data: [Object: null prototype] { '0': [Object: null prototype] }
  }
}

baermathias avatar Sep 05 '23 06:09 baermathias