From 09e4cadd03d0b01f2852657ad955e625afa8e123 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Tue, 1 Oct 2024 19:36:32 -0700 Subject: [PATCH] node: lowercase primitive expectations of ERR_INVALID_ARG_TYPE --- src/js/node/assert.ts | 4 ++-- src/js/node/child_process.ts | 4 ++-- src/js/node/events.ts | 2 +- src/js/node/trace_events.ts | 2 +- src/js/node/util.ts | 6 +++--- 5 files changed, 9 insertions(+), 9 deletions(-) diff --git a/src/js/node/assert.ts b/src/js/node/assert.ts index f2445c83da7bb..e5343bd18e495 100644 --- a/src/js/node/assert.ts +++ b/src/js/node/assert.ts @@ -655,7 +655,7 @@ var require_assertion_error = __commonJS({ function AssertionError2(options) { var _this; if ((_classCallCheck(this, AssertionError2), _typeof(options) !== "object" || options === null)) - throw new ERR_INVALID_ARG_TYPE("options", "Object", options); + throw new ERR_INVALID_ARG_TYPE("options", "object", options); var message = options.message, operator = options.operator, stackStartFn = options.stackStartFn, @@ -1083,7 +1083,7 @@ var require_assert = __commonJS({ : expected.$call({}, actual) === !0; } function getActual(fn) { - if (typeof fn != "function") throw new ERR_INVALID_ARG_TYPE("fn", "Function", fn); + if (typeof fn != "function") throw new ERR_INVALID_ARG_TYPE("fn", "function", fn); try { fn(); } catch (e) { diff --git a/src/js/node/child_process.ts b/src/js/node/child_process.ts index 655272b80e146..65827e183a5b2 100644 --- a/src/js/node/child_process.ts +++ b/src/js/node/child_process.ts @@ -1293,7 +1293,7 @@ class ChildProcess extends EventEmitter { options = undefined; } else if (options !== undefined) { if (typeof options !== "object" || options === null) { - throw ERR_INVALID_ARG_TYPE("options", "Object", options); + throw ERR_INVALID_ARG_TYPE("options", "object", options); } } @@ -1765,7 +1765,7 @@ class AbortError extends Error { name = "AbortError"; constructor(message = "The operation was aborted", options = undefined) { if (options !== undefined && typeof options !== "object") { - throw ERR_INVALID_ARG_TYPE("options", "Object", options); + throw ERR_INVALID_ARG_TYPE("options", "object", options); } super(message, options); } diff --git a/src/js/node/events.ts b/src/js/node/events.ts index ca9cce2d3bc5e..b1545d24bc738 100644 --- a/src/js/node/events.ts +++ b/src/js/node/events.ts @@ -482,7 +482,7 @@ function eventTargetAgnosticAddListener(emitter, name, listener, flags) { class AbortError extends Error { constructor(message = "The operation was aborted", options = undefined) { if (options !== undefined && typeof options !== "object") { - throw ERR_INVALID_ARG_TYPE("options", "Object", options); + throw ERR_INVALID_ARG_TYPE("options", "object", options); } super(message, options); this.code = "ABORT_ERR"; diff --git a/src/js/node/trace_events.ts b/src/js/node/trace_events.ts index e0cb82f344489..762a565b786f6 100644 --- a/src/js/node/trace_events.ts +++ b/src/js/node/trace_events.ts @@ -14,7 +14,7 @@ function ERR_INVALID_ARG_TYPE(name, type, value) { function createTracing(opts) { if (typeof opts !== "object" || opts == null) { // @ts-ignore - throw new ERR_INVALID_ARG_TYPE("options", "Object", opts); + throw new ERR_INVALID_ARG_TYPE("options", "object", opts); } // TODO: validate categories diff --git a/src/js/node/util.ts b/src/js/node/util.ts index 58fb2f9277923..3541d1b80683f 100644 --- a/src/js/node/util.ts +++ b/src/js/node/util.ts @@ -137,15 +137,15 @@ var log = function log() { }; var inherits = function inherits(ctor, superCtor) { if (ctor === undefined || ctor === null) { - throw ERR_INVALID_ARG_TYPE("ctor", "Function", ctor); + throw ERR_INVALID_ARG_TYPE("ctor", "function", ctor); } if (superCtor === undefined || superCtor === null) { - throw ERR_INVALID_ARG_TYPE("superCtor", "Function", superCtor); + throw ERR_INVALID_ARG_TYPE("superCtor", "function", superCtor); } if (superCtor.prototype === undefined) { - throw ERR_INVALID_ARG_TYPE("superCtor.prototype", "Object", superCtor.prototype); + throw ERR_INVALID_ARG_TYPE("superCtor.prototype", "object", superCtor.prototype); } ctor.super_ = superCtor; Object.setPrototypeOf(ctor.prototype, superCtor.prototype);