Skip to content

Commit

Permalink
crypto: use validateObject
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
VoltrexKeyva authored and BethGriggs committed Sep 21, 2021
1 parent e86a813 commit 7557d4e
Showing 1 changed file with 1 addition and 2 deletions.
3 changes: 1 addition & 2 deletions lib/internal/crypto/keys.js
Original file line number Diff line number Diff line change
Expand Up @@ -299,8 +299,7 @@ function isStringOrBuffer(val) {
}

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

const isInput = keyType === undefined;

Expand Down

0 comments on commit 7557d4e

Please sign in to comment.