Skip to content

Commit ecd584b

Browse files
cola119guangwong
authored andcommitted
util: refactor to use validateObject
PR-URL: nodejs/node#43769 Reviewed-By: Colin Ihrig <cjihrig@gmail.com> Reviewed-By: Darshan Sen <raisinten@gmail.com> Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com> Reviewed-By: Mohammed Keyvanzadeh <mohammadkeyvanzade94@gmail.com>
1 parent 3515fae commit ecd584b

File tree

1 file changed

+1
-7
lines changed

1 file changed

+1
-7
lines changed

lib/internal/util/inspect.js

Lines changed: 1 addition & 7 deletions
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

@@ -2099,10 +2096,7 @@ function format(...args) {
20992096
}
21002097

21012098
function formatWithOptions(inspectOptions, ...args) {
2102-
if (typeof inspectOptions !== 'object' || inspectOptions === null) {
2103-
throw new ERR_INVALID_ARG_TYPE(
2104-
'inspectOptions', 'object', inspectOptions);
2105-
}
2099+
validateObject(inspectOptions, 'inspectOptions', { allowArray: true });
21062100
return formatWithOptionsInternal(inspectOptions, args);
21072101
}
21082102

0 commit comments

Comments
 (0)