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

Add support for diff-ing Symbols

ioxua opened this issue · comments

Running the code:

const { DeepDiff } = require("deep-diff")
const foo = {
  [Symbol.iterator]: "Let's pretend this is an iterator"
}
const bar = {
  bar: "Random prop"
}

console.log(DeepDiff(foo, bar))

Results in:

[ DiffNew { kind: 'N', path: [ 'bar' ], rhs: 'Random prop' } ]

Instead of:

[ DiffNew { kind: 'N', path: [ 'bar' ], rhs: 'Random prop' },
  DiffDeleted { kind: 'D', path: [ Symbol.iterator ], lhs: 'Let's pretend this is an iterator' },]

That would be preferable. There is any reason it happens this way?