Update is-objectid.ts (#4277)

* Update is-objectid.ts

* Update is-objectid.ts
This commit is contained in:
Acid Chicken (硫酸鶏) 2019-02-15 23:42:44 +09:00 committed by syuilo
parent 0064dbb010
commit 2776934728

View File

@ -1,5 +1,5 @@
import { ObjectID } from 'mongodb';
export default function(x: any): x is ObjectID {
return x.hasOwnProperty('toHexString') || x.hasOwnProperty('_bsontype');
return x && typeof x === 'object' && (x.hasOwnProperty('toHexString') || x.hasOwnProperty('_bsontype'));
}