From cf371b12b0bc2969059bd1d5e5560f301e3c8141 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Mon, 6 Jan 2025 21:26:16 -0800 Subject: [PATCH] revert src/js/internal/util/inspect.js change --- src/js/internal/util/inspect.js | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/src/js/internal/util/inspect.js b/src/js/internal/util/inspect.js index af4e278da91288..a67c9dd49cd026 100644 --- a/src/js/internal/util/inspect.js +++ b/src/js/internal/util/inspect.js @@ -33,8 +33,6 @@ const { pathToFileURL } = require("node:url"); let BufferModule; -const { validateObject } = require("internal/validators"); - const primordials = require("internal/primordials"); const { Array, @@ -355,6 +353,18 @@ const codes = {}; // exported from errors.js return error; }; } +/** + * @param {unknown} value + * @param {string} name + * @param {{ allowArray?: boolean, allowFunction?: boolean, nullable?: boolean }} [options] */ +const validateObject = (value, name, allowArray = false) => { + if ( + value === null || + (!allowArray && $isJSArray(value)) || + (typeof value !== "object" && typeof value !== "function") + ) + throw new codes.ERR_INVALID_ARG_TYPE(name, "Object", value); +}; const builtInObjects = new SafeSet( ArrayPrototypeFilter(