Skip to content

Commit d80082f

Browse files
VoltrexKeyvaBethGriggs
authored andcommittedSep 21, 2021
crypto: use validateObject
The `validateObject()` validator can be used to cleanup validation and keep consistency. PR-URL: #39872 Reviewed-By: Zijian Liu <lxxyxzj@gmail.com> Reviewed-By: Khaidi Chu <i@2333.moe> Reviewed-By: James M Snell <jasnell@gmail.com>
1 parent 59fff92 commit d80082f

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)
Please sign in to comment.