andreyvit/json-diff

Version 0.5.5 Error

wwepenguin opened this issue · 1 comments

const jsonDiff = require('json-diff')
let a = {
    "s": [[{ "b": '123' }]]
}

let b = {
    "s": [[{ "b": 'abc' }], []],
}


let diff_out = jsonDiff.diffString(a, b);

console.log(diff_out);

b object has empty array will throw error at

/node_modules/json-diff/lib/index.js:100
if (!keyScores[bestMatch.key] || bestMatch.score > keyScores[bestMatch.key].score) {
^

TypeError: Cannot read property 'key' of null

Thanks for the bug report!

This has been fixed in version 0.6.3