Skip to content

Commit 42021e4

Browse files
doc: update migration recomendations for util.is**() deprecations
PR-URL: #59269 Reviewed-By: James M Snell <[email protected]> Reviewed-By: Jordan Harband <[email protected]> Reviewed-By: Chemi Atlow <[email protected]> Reviewed-By: Zeyu "Alex" Yang <[email protected]> Reviewed-By: Antoine du Hamel <[email protected]>
1 parent b1898c5 commit 42021e4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

doc/api/deprecations.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1085,6 +1085,10 @@ Type: End-of-Life
10851085
The `util.isDate()` API has been removed. Please use
10861086
`arg instanceof Date` instead.
10871087

1088+
Also for stronger approaches, consider using:
1089+
`Date.prototype.toString.call(arg) === '[object Date]' && !isNaN(arg)`.
1090+
This can also be used in a `try/catch` block to handle invalid date objects.
1091+
10881092
### DEP0048: `util.isError()`
10891093

10901094
<!-- YAML
@@ -1109,9 +1113,7 @@ changes:
11091113

11101114
Type: End-of-Life
11111115

1112-
The `util.isError()` API has been removed. Please use
1113-
`Object.prototype.toString(arg) === '[object Error]' || arg instanceof Error`
1114-
instead.
1116+
The `util.isError()` API has been removed. Please use `Error.isError(arg)`.
11151117

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

@@ -1272,9 +1274,7 @@ changes:
12721274

12731275
Type: End-of-Life
12741276

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

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

0 commit comments

Comments
 (0)