Skip to content

Commit

Permalink
vm: refactor to use validateStringArray
Browse files Browse the repository at this point in the history
PR-URL: #46020
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Minwoo Jung <nodecorelab@gmail.com>
  • Loading branch information
deokjinkim authored and juanarbol committed Jan 24, 2023
1 parent 11cd248 commit d46f974
Showing 1 changed file with 2 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/internal/vm.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ const {
validateFunction,
validateObject,
validateString,
validateStringArray,
validateUint32,
} = require('internal/validators');
const {
Expand All @@ -30,9 +31,7 @@ function isContext(object) {
function internalCompileFunction(code, params, options) {
validateString(code, 'code');
if (params !== undefined) {
validateArray(params, 'params');
ArrayPrototypeForEach(params,
(param, i) => validateString(param, `params[${i}]`));
validateStringArray(params, 'params');
}

const {
Expand Down

0 comments on commit d46f974

Please sign in to comment.