Skip to content

Commit

Permalink
fix: added check for Array.isArray
Browse files Browse the repository at this point in the history
  • Loading branch information
niftylettuce committed May 31, 2020
1 parent eaaf20d commit 510810d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion objectid.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ ObjectID.createFromHexString = function(hexString) {
* http://mongodb.github.io/node-mongodb-native/api-bson-generated/objectid.html#objectid-isvalid
*/
ObjectID.isValid = function(objectid) {
if(!objectid || (typeof objectid !== 'string' && (typeof objectid !== 'object' || typeof objectid.toString !== 'function'))) return false;
if(!objectid || (typeof objectid !== 'string' && (typeof objectid !== 'object' || Array.isArray(objectid) || typeof objectid.toString !== 'function'))) return false;

//call .toString() to get the hex if we're
// working with an instance of ObjectID
Expand Down

0 comments on commit 510810d

Please sign in to comment.