Skip to content

Commit 55379eb

Browse files
VoltrexKeyvanodejs-github-bot
authored andcommitted
crypto: use validateObject
The `validateObject()` validator can be used to cleanup validation and keep consistency. PR-URL: #39872 Reviewed-By: Zijian Liu <[email protected]> Reviewed-By: Khaidi Chu <[email protected]> Reviewed-By: James M Snell <[email protected]>
1 parent 8a92018 commit 55379eb

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

lib/internal/crypto/keys.js

+1-2
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ function isStringOrBuffer(val) {
299299
}
300300

301301
function parseKeyEncoding(enc, keyType, isPublic, objName) {
302-
if (enc === null || typeof enc !== 'object')
303-
throw new ERR_INVALID_ARG_TYPE('options', 'object', enc);
302+
validateObject(enc, 'options');
304303

305304
const isInput = keyType === undefined;
306305

0 commit comments

Comments
 (0)