Skip to content

Commit f32aec8

Browse files
cola119danielleadams
authored andcommitted
util: refactor to use validateObject
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]>
1 parent 8432d65 commit f32aec8

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

lib/internal/util/inspect.js

+1-7
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,6 @@ const {
104104
} = require('internal/util');
105105

106106
const {
107-
codes: {
108-
ERR_INVALID_ARG_TYPE
109-
},
110107
isStackOverflowError
111108
} = require('internal/errors');
112109

@@ -2101,10 +2098,7 @@ function format(...args) {
21012098
}
21022099

21032100
function formatWithOptions(inspectOptions, ...args) {
2104-
if (typeof inspectOptions !== 'object' || inspectOptions === null) {
2105-
throw new ERR_INVALID_ARG_TYPE(
2106-
'inspectOptions', 'object', inspectOptions);
2107-
}
2101+
validateObject(inspectOptions, 'inspectOptions', { allowArray: true });
21082102
return formatWithOptionsInternal(inspectOptions, args);
21092103
}
21102104

0 commit comments

Comments
 (0)