From dd00547adadb93361228289d8d2ab9233128c7d9 Mon Sep 17 00:00:00 2001 From: Voltrex <62040526+VoltrexMaster@users.noreply.github.com> Date: Fri, 4 Jun 2021 23:11:25 +0430 Subject: [PATCH] vm: use missing validator The `vm` lib module's `isContext()` function should use a validator. PR-URL: https://github.com/nodejs/node/pull/38935 Reviewed-By: Gus Caplan Reviewed-By: Zijian Liu Reviewed-By: Anna Henningsen Reviewed-By: Darshan Sen Reviewed-By: Luigi Pinca Reviewed-By: James M Snell --- lib/vm.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) 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); }