From 510810d7b9fac2d8c25ab57e3f38e8af25b4e1e0 Mon Sep 17 00:00:00 2001 From: niftylettuce Date: Sat, 30 May 2020 21:00:38 -0500 Subject: [PATCH] fix: added check for Array.isArray --- objectid.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/objectid.js b/objectid.js index b3991a9..fea220f 100644 --- a/objectid.js +++ b/objectid.js @@ -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