lib: refactor to use validateBoolean

PR-URL: https://github.com/nodejs/node/pull/36983
Reviewed-By: Michaël Zasso <targos@protonmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
This commit is contained in:
ZiJian Liu 2021-01-18 19:39:25 +08:00 committed by James M Snell
parent 96f3977ded
commit cb5668be99
No known key found for this signature in database
GPG key ID: 7341B15C070877AC
5 changed files with 11 additions and 20 deletions

View file

@ -90,10 +90,7 @@ class Script extends ContextifyScript {
cachedData
);
}
if (typeof produceCachedData !== 'boolean') {
throw new ERR_INVALID_ARG_TYPE('options.produceCachedData', 'boolean',
produceCachedData);
}
validateBoolean(produceCachedData, 'options.produceCachedData');
// Calling `ReThrow()` on a native TryCatch does not generate a new
// abort-on-uncaught-exception check. A dummy try/catch in JS land