flitbit / diff

Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Feature request: report differences in prototype

cpcallen opened this issue · comments

These comparisons should all report some difference, but in fact do not:

diff({}, Object.create(null))  // === undefined

diff({}, Object.create({}))  // === undefined

var F = function(){};
diff({}, new F);  // === undefined

(I'm pleased to see that you do correctly return a non-empty diff for diff([], Object.create(Array.prototype)), though.)

For most objects it would be reasonable to report different prototypes using __proto__ notation, but for objects created using Object.create(null) or which have had an Object.defineProperty(o, '__proto__') done to them some other notation will be necessary.