diff --git a/lib/vm.js b/lib/vm.js index 79c97f3af3ff02..bad7f21a9b1398 100644 --- a/lib/vm.js +++ b/lib/vm.js @@ -211,9 +211,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); }