diffJson throws on `Object.create(null)` in some cases
danbeam opened this issue · comments
Dan Beam commented
Minimal repro:
diffJson(Object.assign(Object.create(null), {a: 123}), {b: 456});
With an error like:
/.../node_modules/diff/src/diff/json.js:68
if (obj.hasOwnProperty(key)) {
^
TypeError: obj.hasOwnProperty is not a function
As far as I can tell, some popular libraries export object with these setups (e.g. eslint
and express
). I believe I have a simple fix.