Skip to content

Commit d80082f

Browse files
VoltrexKeyvaBethGriggs
authored andcommitted
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

1 file changed

Lines changed: 1 addition & 2 deletions

File tree

‎lib/internal/crypto/keys.js‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -299,8 +299,7 @@ function isStringOrBuffer(val) {
299299
}
300300

301301
functionparseKeyEncoding(enc,keyType,isPublic,objName){
302-
if(enc===null||typeofenc!=='object')
303-
thrownewERR_INVALID_ARG_TYPE('options','object',enc);
302+
validateObject(enc,'options');
304303

305304
constisInput=keyType===undefined;
306305

0 commit comments

Comments
 (0)