diff options
author | Voltrex <62040526+VoltrexMaster@users.noreply.github.com> | 2021-06-04 21:41:25 +0300 |
---|---|---|
committer | Michaƫl Zasso <targos@protonmail.com> | 2021-06-11 08:24:56 +0300 |
commit | f40725f2a1d536e1f2b59fcadb5c5085bbe74917 (patch) | |
tree | 5d1bda34dcf205cf596fdd9f92fcda1c37d247ce /lib | |
parent | e87cd4542b29098df25c2813382d8df559549c36 (diff) |
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 <me@gus.host>
Reviewed-By: Zijian Liu <lxxyxzj@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Diffstat (limited to 'lib')
-rw-r--r-- | lib/vm.js | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/lib/vm.js b/lib/vm.js index 0b643110ae9..d8e3d658603 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); } |