Skip to content

Commit 3276bfa

Browse files
AugustinMauroytargos
authored andcommitted
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 5761724 commit 3276bfa

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
@@ -1079,6 +1079,10 @@ Type: End-of-Life
10791079
The `util.isDate()` API has been removed. Please use
10801080
`arg instanceof Date` instead.
10811081

1082+
Also for stronger approaches, consider using:
1083+
`Date.prototype.toString.call(arg) === '[object Date]' && !isNaN(arg)`.
1084+
This can also be used in a `try/catch` block to handle invalid date objects.
1085+
10821086
### DEP0048: `util.isError()`
10831087

10841088
<!-- YAML
@@ -1103,9 +1107,7 @@ changes:
11031107

11041108
Type: End-of-Life
11051109

1106-
The `util.isError()` API has been removed. Please use
1107-
`Object.prototype.toString(arg) === '[object Error]' || arg instanceof Error`
1108-
instead.
1110+
The `util.isError()` API has been removed. Please use `Error.isError(arg)`.
11091111

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

@@ -1266,9 +1268,7 @@ changes:
12661268

12671269
Type: End-of-Life
12681270

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

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

0 commit comments

Comments
 (0)