From 9cdb0513f85aa768b2c8ebbe814c63d5bf26aab4 Mon Sep 17 00:00:00 2001 From: cola119 Date: Mon, 11 Jul 2022 15:00:22 +0900 Subject: [PATCH] util: refactor to use validateObject --- lib/internal/util/inspect.js | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) diff --git a/lib/internal/util/inspect.js b/lib/internal/util/inspect.js index 0ff86d92970ca5..fc52ba514e771b 100644 --- a/lib/internal/util/inspect.js +++ b/lib/internal/util/inspect.js @@ -104,9 +104,6 @@ const { } = require('internal/util'); const { - codes: { - ERR_INVALID_ARG_TYPE - }, isStackOverflowError } = require('internal/errors'); @@ -2101,10 +2098,7 @@ function format(...args) { } function formatWithOptions(inspectOptions, ...args) { - if (typeof inspectOptions !== 'object' || inspectOptions === null) { - throw new ERR_INVALID_ARG_TYPE( - 'inspectOptions', 'object', inspectOptions); - } + validateObject(inspectOptions, 'inspectOptions', { allowArray: true }); return formatWithOptionsInternal(inspectOptions, args); }