Skip to content

Commit

Permalink
util: refactor to use validateObject
Browse files Browse the repository at this point in the history
PR-URL: #43769
Reviewed-By: Colin Ihrig <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Luigi Pinca <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
Reviewed-By: Mohammed Keyvanzadeh <[email protected]>
  • Loading branch information
cola119 authored and danielleadams committed Jul 26, 2022
1 parent 8432d65 commit f32aec8
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 f32aec8

Please sign in to comment.