mongojs-hooks
Advanced tools
Comparing version 0.1.6 to 0.1.7
@@ -87,3 +87,3 @@ var mongojs = require("mongojs"); | ||
// Recurse | ||
if (newObject[sKey] instanceof Object) | ||
if (isObject(newObject[sKey])) | ||
newObject[sKey] = this.sanitise(newObject[sKey]); | ||
@@ -116,3 +116,3 @@ }.bind(this)); | ||
// Recurse | ||
if (newObject[key] instanceof Object) | ||
if (isObject(newObject[key])) | ||
newObject[key] = this.unsanitise(newObject[key]); | ||
@@ -125,2 +125,12 @@ }.bind(this)); | ||
var isObject = function (obj) { | ||
if (typeof obj !== "object" || obj === null) | ||
return false; | ||
var ObjProto = obj; | ||
while (Object.getPrototypeOf(ObjProto = Object.getPrototypeOf(ObjProto)) !== null) ; | ||
return Object.getPrototypeOf(obj) === ObjProto; | ||
}; | ||
module.exports = mongojs; |
{ | ||
"name": "mongojs-hooks", | ||
"description": "Wrap monogjs in pre and post hooks", | ||
"version": "0.1.6", | ||
"version": "0.1.7", | ||
"main": "./mongojs-hooks", | ||
@@ -6,0 +6,0 @@ "author": { |
@@ -125,2 +125,12 @@ var mongo = require("../mongojs-hooks"); | ||
}); | ||
describe("when includes a Date", function () { | ||
it("should not alter date", function () { | ||
var date = new Date("2015-03-02"); | ||
var sanitised = mongo.util.sanitise({ date: date }); | ||
(sanitised.date instanceof Date).should.be.true; | ||
sanitised.date.should.deep.equal(new Date("2015-03-02")); | ||
}); | ||
}); | ||
}); | ||
@@ -249,3 +259,13 @@ | ||
}); | ||
describe("when includes a Date", function () { | ||
it("should not alter date", function () { | ||
var date = new Date("2015-03-02"); | ||
var unsanitised = mongo.util.unsanitise({ date: date }); | ||
(unsanitised.date instanceof Date).should.be.true; | ||
unsanitised.date.should.deep.equal(new Date("2015-03-02")); | ||
}); | ||
}); | ||
}); | ||
}); |
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
27314
545