From 8a8af47593517ddd05e1ad57e8912b0fd1c04176 Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Tue, 29 Jul 2025 10:02:40 +0200 Subject: [PATCH 1/5] doc: update deprecation guide for `util.is**()` --- doc/api/deprecations.md | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index a111b3a0d6ce4e..4e2610b3cf03cc 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1109,9 +1109,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()` @@ -1192,7 +1190,7 @@ changes: Type: End-of-Life The `util.isNullOrUndefined()` API has been removed. Please use -`arg === null || arg === undefined` instead. +`arg === null` instead. ### DEP0052: `util.isNumber()` From fa06eeb08acf449c1b5ec7a243bca6b26e0e950a Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Tue, 29 Jul 2025 19:28:02 +0200 Subject: [PATCH 2/5] fix: null & undifined Co-authored-by: James M Snell --- doc/api/deprecations.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 4e2610b3cf03cc..e1ebbb4af61dbe 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1190,7 +1190,7 @@ changes: Type: End-of-Life The `util.isNullOrUndefined()` API has been removed. Please use -`arg === null` instead. +`arg == null` instead. ### DEP0052: `util.isNumber()` From 2e80adfcee858102506639f59b0094fa0b29ed4c Mon Sep 17 00:00:00 2001 From: Augustin Mauroy <97875033+AugustinMauroy@users.noreply.github.com> Date: Tue, 29 Jul 2025 21:41:08 +0200 Subject: [PATCH 3/5] better handling --- doc/api/deprecations.md | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 4e2610b3cf03cc..66812e6b873294 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1085,6 +1085,9 @@ 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)` It's also can be used in a `try/catch` block to catch invalid date objects. + ### DEP0048: `util.isError()`