Skip to content

Commit

Permalink
util: refactor to use validateObject
Browse files Browse the repository at this point in the history
  • Loading branch information
cola119 committed Jul 11, 2022
1 parent 7cc1917 commit 9cdb051
Showing 1 changed file with 1 addition and 7 deletions.
8 changes: 1 addition & 7 deletions lib/internal/util/inspect.js
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,6 @@ const {
} = require('internal/util');

const {
codes: {
ERR_INVALID_ARG_TYPE
},
isStackOverflowError
} = require('internal/errors');

Expand Down Expand Up @@ -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);
}

Expand Down

0 comments on commit 9cdb051

Please sign in to comment.