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 constructor name

alexanderbird opened this issue · comments

It would be nice to have a new diff type indicator for mismatched constructors.

kind: 'C'
path, is set as they would be for 'E' differences
lhs is the value of the lhs item's constructor.name property
rhs as with lhs
index and item are unused

Example:

function Something(value) { this.value = value; }

var lhs = new Something('foo');
var rhs = { value: 'foo' };

Diffing the two would produce:

[{ kind: 'C',
    path: [  ],
    lhs: 'Something',
    rhs: 'Object' }]