json-diff-ts
json-diff-ts copied to clipboard
compare on arrays produces an unexpected UNCHANGED entry
Consider the following :
import { compare } from 'json-diff-ts'
console.log(compare(["foo"], ["bar"]))
The result is :
{ type: 'CONTAINER', value: [ { type: 'UNCHANGED', value: 'foo' }, '$root': [ [Object] ] ] }
(the actual change is hidden inside the $root key) Is this intended ?
It seems inconsistent with what happens for objects :
import { compare } from 'json-diff-ts'
console.log(compare({ "k": "foo" }, { "k": "bar" }))
{ type: 'CONTAINER', value: { k: { type: 'UPDATE', value: 'bar', oldValue: 'foo' } } }