Skip to content

Commit

Permalink
vm: use missing validator
Browse files Browse the repository at this point in the history
The `vm` lib module's `isContext()` function should use a validator.

PR-URL: #38935
Reviewed-By: Gus Caplan <[email protected]>
Reviewed-By: Zijian Liu <[email protected]>
Reviewed-By: Anna Henningsen <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
VoltrexKeyva authored and richardlau committed Jul 19, 2021
1 parent b7b01aa commit 31359e1
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 31359e1

Please sign in to comment.