diff --git a/lib/vm.js b/lib/vm.js index 0b643110ae9465..d8e3d6586036f3 100644 --- a/lib/vm.js +++ b/lib/vm.js @@ -206,9 +206,8 @@ function getContextOptions(options) { } function isContext(object) { - if (typeof object !== 'object' || object === null) { - throw new ERR_INVALID_ARG_TYPE('object', 'Object', object); - } + validateObject(object, 'object', { allowArray: true }); + return _isContext(object); }