flitbit / diff

Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

duplicate path when diff array of object property

shenrenguo opened this issue · comments

left = { key: [ {A: 0, B: 1}, {A: 2, B: 3} ] }
right = { key: [ {A: 9, B: 1}, {A: 2, B: 3} ] }

r = diff(left, right)
only one changes occurred, but the output difference have 3:
{kind: 'E', path: ['key', 0, 'A'], lhs: 0, rhs: 9}
{kind: 'E', path: ['key.0', 'A'], lhs: 0, rhs: 9}
{kind: 'E', path: ['key.0.A'], lhs: 0, rhs: 9}

Added a script that shows this is not an issue: look at issue-124.js... if you still have issues, please tell me more about your environment, versions, etc.