File tree Expand file tree Collapse file tree 1 file changed +14
-5
lines changed
Expand file tree Collapse file tree 1 file changed +14
-5
lines changed Original file line number Diff line number Diff line change @@ -140,12 +140,21 @@ function validateBoolean(value, name) {
140140 throw new ERR_INVALID_ARG_TYPE(name, 'boolean', value);
141141}
142142
143+ /**
144+ * @param {unknown} value
145+ * @param {string} name
146+ * @param {{
147+ * allowArray?: boolean,
148+ * allowFunction?: boolean,
149+ * nullable?: boolean
150+ * }} [options]
151+ */
143152const validateObject = hideStackFrames(
144- (value, name, {
145- nullable = false,
146- allowArray = false,
147- allowFunction = false,
148- } = {}) => {
153+ (value, name, options) => {
154+ const useDefaultOptions = options == null;
155+ const allowArray = useDefaultOptions ? false : options.allowArray;
156+ const allowFunction = useDefaultOptions ? false : options.allowFunction;
157+ const nullable = useDefaultOptions ? false : options.nullable;
149158 if ((!nullable && value === null) ||
150159 (!allowArray && ArrayIsArray(value)) ||
151160 (typeof value !== 'object' && (
You can’t perform that action at this time.
0 commit comments