Skip to content
Merged
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1085,6 +1085,10 @@ Type: End-of-Life
The `util.isDate()` API has been removed. Please use
`arg instanceof Date` instead.

Also for stronger approaches, consider using:
`Date.prototype.toString.call(arg) === '[object Date]' && !isNaN(arg)`.
This can also be used in a `try/catch` block to handle invalid date objects.

### DEP0048: `util.isError()`

<!-- YAML
Expand All @@ -1109,9 +1113,7 @@ changes:

Type: End-of-Life

The `util.isError()` API has been removed. Please use
`Object.prototype.toString(arg) === '[object Error]' || arg instanceof Error`
instead.
The `util.isError()` API has been removed. Please use `Error.isError(arg)`.

### DEP0049: `util.isFunction()`

Expand Down Expand Up @@ -1192,7 +1194,7 @@ changes:
Type: End-of-Life

The `util.isNullOrUndefined()` API has been removed. Please use
`arg === null || arg === undefined` instead.
`arg == null` instead.
Copy link
Contributor

@aduh95 aduh95 Aug 27, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The previous suggestion was more correct, if arg is an instance of HTMLAllCollection, arg == null would be true while util.isNullOrUndefined(arg) and arg === null || arg === undefined would both be false.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

proposed here #59269 (comment)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should I revert this change ?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#59269 (comment) suggests this because your original change was even more wrong (i.e. it would not treat undefined as a false negative). This new suggestion still has a blind spot (it treats document.all as a false positive), IMO yes reverting is the correct call, because this change is not an improvement.

FWIW you can find this behavior spec'd in step 4 of the IsLooselyEqual section of ECMAScript. Node.js users should encounter it only with Electron or similar.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ah, right. that's a fair point. in regular node code there's no such thing as document.all so it has no impact, but as a general JS guideline and in electron, @aduh95 is correct.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i had reverted change


### DEP0052: `util.isNumber()`

Expand Down Expand Up @@ -1272,9 +1274,7 @@ changes:

Type: End-of-Life

The `util.isPrimitive()` API has been removed. Please use
`arg === null || (typeof arg !=='object' && typeof arg !== 'function')`
instead.
The `util.isPrimitive()` API has been removed. Please use `Object(arg) !== arg` instead.

### DEP0055: `util.isRegExp()`

Expand Down
Loading