Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var comparing = [];
function compare(path, old, new_) {
var changes = [];
if (old !== null && new_ !== null &&
typeof old === 'object' &&
typeof old === 'object' && typeof new_ === 'object' &&
!_.contains(comparing, old)) {

comparing.push(old);
Expand Down
8 changes: 8 additions & 0 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -243,4 +243,12 @@ describe('changeset', function () {
]);
done();
});

it('should be able to diff from an object to a basic type', function() {
var a = {hello: {nested: 2}};
var b = {hello: 3};
var changeset = diff(a, b);
var b_ = diff.apply(changeset, a);
expect(b).to.deep.equals(b_);
});
});