From b959145cd7513734947f75b55d2728d9a7941b05 Mon Sep 17 00:00:00 2001 From: Voltrex Date: Wed, 25 Aug 2021 02:55:58 +0430 Subject: [PATCH] crypto: use `validateObject` The `validateObject()` validator can be used to cleanup validation and keep consistency. --- lib/internal/crypto/keys.js | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/lib/internal/crypto/keys.js b/lib/internal/crypto/keys.js index 1127217d6b9dee..c713bbdb0882e1 100644 --- a/lib/internal/crypto/keys.js +++ b/lib/internal/crypto/keys.js @@ -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(env, 'options'); const isInput = keyType === undefined;