bson-objectid
Advanced tools
Comparing version 1.2.5 to 1.3.0
@@ -98,3 +98,3 @@ | ||
ObjectID.isValid = function(objectid) { | ||
if(!objectid) return false; | ||
if(!objectid || (typeof objectid !== 'string' && (typeof objectid !== 'object' || typeof objectid.toString !== 'function'))) return false; | ||
@@ -101,0 +101,0 @@ //call .toString() to get the hex if we're |
{ | ||
"name": "bson-objectid", | ||
"version": "1.2.5", | ||
"version": "1.3.0", | ||
"description": "Construct ObjectIDs without the mongodb driver or bson module", | ||
@@ -5,0 +5,0 @@ "main": "objectid.js", |
@@ -177,3 +177,9 @@ | ||
}); | ||
it("should not throw an error for objects without toString", function() { | ||
var obj = Object.create({}, { toString: { value: false, writeable: false } }); | ||
obj.toString.should.not.be.ok; | ||
ObjectID.isValid(obj).should.not.be.ok; | ||
}); | ||
}); | ||
33033
449