From 8d1c38b8491f2a1d0e3f3329b1b98261dfc769a6 Mon Sep 17 00:00:00 2001 From: Voltrex Date: Fri, 18 Jun 2021 06:39:40 +0430 Subject: [PATCH] wasi: use missing validator The `wasi` lib module's `initialize()` method is missing a validator. --- lib/wasi.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/wasi.js b/lib/wasi.js index 63209ce716cb9a..b2cb5b7a460a8e 100644 --- a/lib/wasi.js +++ b/lib/wasi.js @@ -147,9 +147,9 @@ class WASI { const { _start, _initialize } = this[kInstance].exports; - if (typeof _initialize !== 'function' && _initialize !== undefined) { - throw new ERR_INVALID_ARG_TYPE( - 'instance.exports._initialize', 'function', _initialize); + if (_initialize !== undefined) { + validateFunction( + _initialize, 'instance.exports._initialize'); } if (_start !== undefined) { throw new ERR_INVALID_ARG_TYPE(