microdiff
microdiff copied to clipboard
Cannot use 'in' operator to search for ... in null
const diff = require('microdiff').default
const a1 = {"a": { "b": 1 }}
const a2 = {"a": null}
console.log(diff(a1, a2))
/Users/.../node_modules/microdiff/dist/index.cjs:8
if (!(key in newObj)) {
^
TypeError: Cannot use 'in' operator to search for 'b' in null
Thanks for reporting this! I will work on a fix, it should not take long.
Ok, this should be fixed now. Let me know if you continue to have problems with this in version v1.1.1+.
@AsyncBanana I'm having same issue in "microdiff": "^1.3.2"
Could you send me the relevant code?
Getting the same issue (comparing arrays of objects with arrays inside). It happens when the root object is undefined or null (might want to check that).