From daffa4671c77d2eef2fff9548f5472ff9f941073 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..93c04df5403402 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(enc, 'options'); const isInput = keyType === undefined;