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 <lxxyxzj@gmail.com>
Reviewed-By: Khaidi Chu <i@2333.moe>
Reviewed-By: James M Snell <jasnell@gmail.com>
  • Loading branch information
VoltrexKeyva authored and nodejs-github-bot committed Sep 17, 2021
1 parent 8a92018 commit 55379eb
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 55379eb

Please sign in to comment.