Comparing version 2.12.1 to 2.12.2
@@ -1,2 +0,3 @@ | ||
var _ = require('lodash'); | ||
var _ = require('lodash'), | ||
ObjectID = require('mongodb').ObjectID; | ||
@@ -32,2 +33,5 @@ module.exports = diff; | ||
if(original instanceof ObjectID && modified instanceof ObjectID) | ||
return !original.equals(modified) && this.set(changePath, modified); | ||
if(!_.isPlainObject(original) || !_.isPlainObject(modified)) | ||
@@ -34,0 +38,0 @@ return !_.isEqual(original, modified) && this.set(changePath, modified); |
{ | ||
"name": "iridium", | ||
"version": "2.12.1", | ||
"version": "2.12.2", | ||
"author": "Benjamin Pannell <admin@sierrasoftworks.com>", | ||
@@ -5,0 +5,0 @@ "description": "A custom lightweight ORM for MongoDB designed for power-users", |
@@ -1,2 +0,3 @@ | ||
var diff = require('../lib/utils/diff'); | ||
var diff = require('../lib/utils/diff'), | ||
ObjectID = require('mongodb').ObjectID; | ||
@@ -54,2 +55,25 @@ describe('diff', function() { | ||
it('should correctly diff ObjectIDs', function() { | ||
var o1 = new ObjectID(); | ||
var o2 = ObjectID.createFromHexString(o1.toHexString()); | ||
var a1 = { _id: o1 }; | ||
var a2 = { _id: o2 }; | ||
var expected = { | ||
}; | ||
diff(a1, a2).should.eql(expected); | ||
o2 = new ObjectID(); | ||
var a1 = { _id: o1 }; | ||
var a2 = { _id: o2 }; | ||
var expected = { | ||
$set: { _id: o2 } | ||
}; | ||
diff(a1, a2).should.eql(expected); | ||
}); | ||
describe('arrays', function() { | ||
@@ -56,0 +80,0 @@ it('should correctly handle arrays which can be pulled', function() { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
159381
2953