From f40725f2a1d536e1f2b59fcadb5c5085bbe74917 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 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); }