Comparing version 0.1.3 to 0.1.4
@@ -91,3 +91,5 @@ ;(function(undefined) { | ||
changes(new DiffEdit(currentPath, lhs, rhs)); | ||
} else if (ltype === 'object' && lhs != null) { | ||
} else if (lhs instanceof Date && rhs instanceof Date && ((lhs-rhs) != 0) ) { | ||
changes(new DiffEdit(currentPath, lhs, rhs)); | ||
} else if (ltype === 'object' && lhs != null && rhs != null) { | ||
stack = stack || []; | ||
@@ -94,0 +96,0 @@ if (stack.indexOf(lhs) < 0) { |
{ | ||
"name": "deep-diff", | ||
"description": "Javascript utility for calculating deep difference, capturing changes, and applying changes across objects; for nodejs and the browser.", | ||
"version": "0.1.3", | ||
"version": "0.1.4", | ||
"keywords": [ | ||
@@ -13,3 +13,4 @@ "diff", | ||
"contributors": [ | ||
"SocalNick" | ||
"SocalNick", | ||
"sonstone" | ||
], | ||
@@ -16,0 +17,0 @@ "repository": { "type": "git", "url": "git://github.com/flitbit/diff.git" }, |
@@ -97,4 +97,28 @@ if (typeof require === 'function') { | ||
it('shows that an object property is changed when it is set to null', function() { | ||
lhs.key = {nested: 'value'}; | ||
var diff = deep.diff(lhs, { key: null }); | ||
expect(diff).to.be.ok(); | ||
expect(diff.length).to.be(1); | ||
expect(diff[0]).to.have.property('kind'); | ||
expect(diff[0].kind).to.be('E'); | ||
}); | ||
}); | ||
describe('A target that has a date value', function() { | ||
var lhs = { key: new Date(555555555555) }; | ||
it('shows the property is changed with a new date value', function() { | ||
var diff = deep.diff(lhs, { key: new Date(777777777777) }); | ||
expect(diff).to.be.ok(); | ||
expect(diff.length).to.be(1); | ||
expect(diff[0]).to.have.property('kind'); | ||
expect(diff[0].kind).to.be('E'); | ||
}); | ||
}); | ||
describe('When executing in a browser (otherwise these tests are benign)', function() { | ||
@@ -101,0 +125,0 @@ |
476974
3022