Skip to content

Commit

Permalink
node: lowercase primitive expectations of ERR_INVALID_ARG_TYPE (#14284)
Browse files Browse the repository at this point in the history
  • Loading branch information
nektro authored Oct 2, 2024
1 parent db0750e commit e44d10c
Show file tree
Hide file tree
Showing 5 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions src/js/node/assert.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand Down
4 changes: 2 additions & 2 deletions src/js/node/child_process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}

Expand Down Expand Up @@ -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);
}
Expand Down
2 changes: 1 addition & 1 deletion src/js/node/events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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";
Expand Down
2 changes: 1 addition & 1 deletion src/js/node/trace_events.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
6 changes: 3 additions & 3 deletions src/js/node/util.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit e44d10c

Please sign in to comment.