From 5478e1129ae1285fcab59f60cf6a3b894397ff9e Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 12:55:32 +0200 Subject: [PATCH] util: runtime deprecate util.isObject PR-URL: https://github.com/nodejs/node/pull/50488 Reviewed-By: Rafael Gonzaga Reviewed-By: Yagiz Nizipli Reviewed-By: Robert Nagy Reviewed-By: James M Snell Reviewed-By: Ruben Bridgewater Reviewed-By: Joyee Cheung --- doc/api/deprecations.md | 5 ++++- lib/util.js | 3 ++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 4b47665d3e6f82..f7336ae19da623 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1175,6 +1175,9 @@ The [`util.isNumber()`][] API is deprecated. -Type: Documentation-only +Type: Runtime The [`util.isObject()`][] API is deprecated. diff --git a/lib/util.js b/lib/util.js index 00b132934d9b32..eca8ecb980e7a4 100644 --- a/lib/util.js +++ b/lib/util.js @@ -427,7 +427,8 @@ module.exports = { 'The `util.isRegExp` API is deprecated. Please use `arg instanceof RegExp` instead.', 'DEP0055'), isObject: deprecate(isObject, - 'The `util.isObject` API is deprecated. Please use `typeof arg === "object"` instead.', + 'The `util.isObject` API is deprecated. ' + + 'Please use `arg !== null && typeof arg === "object"` instead.', 'DEP0053'), isDate: deprecate(types.isDate, 'The `util.isDate API is deprecated. Please use `arg instanceof Error` instead.',