AsyncBanana / microdiff

A fast, zero dependency object and array comparison library. Significantly faster than most other deep comparison libraries and has full TypeScript support.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Cannot use 'in' operator to search for ... in null

zarmin opened this issue · comments

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?