Skip to content

Commit f8dbd47

Browse files
committed
update isValid return logic for strings
1 parent 0af5143 commit f8dbd47

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/objectid.ts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,9 +301,8 @@ export class ObjectId {
301301
if (id.length === 12) {
302302
const bytes = Buffer.from(id);
303303
return bytes.byteLength === 12;
304-
} else if (id.length === 24) {
305-
return checkForHexRegExp.test(id);
306304
}
305+
return id.length === 24 && checkForHexRegExp.test(id);
307306
}
308307

309308
if (id instanceof ObjectId) {

0 commit comments

Comments
 (0)