From 5960c6f629f6ccaa6839ffd6b5c1bc4f920adb21 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 12:22:30 +0200 Subject: [PATCH 01/18] util: runtime deprecation util._extend --- doc/api/deprecations.md | 5 ++++- lib/util.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 607678ebbfba95..80b64d7eb0d27c 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1282,6 +1282,9 @@ The [`util.log()`][] API is deprecated. -Type: Documentation-only +Type: Runtime The [`util._extend()`][] API is deprecated. diff --git a/lib/util.js b/lib/util.js index 9ddb332f866355..e1f005369d5873 100644 --- a/lib/util.js +++ b/lib/util.js @@ -375,7 +375,9 @@ function _exceptionWithHostPort(...args) { module.exports = { _errnoException, _exceptionWithHostPort, - _extend, + _extend: deprecate(_extend, + 'The `util._extend` API is deprecated. Please use Object.assign() instead.', + 'DEP0060'), callbackify, debug: debuglog, debuglog, From 09e59f255a1758dcdde004012121563db90ce8c2 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 12:32:34 +0200 Subject: [PATCH 02/18] util: runtime deprecate util.isArray --- doc/api/deprecations.md | 5 ++++- lib/util.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 80b64d7eb0d27c..b0f363316cd946 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -964,6 +964,9 @@ The [`tls.SecurePair`][] class is deprecated. Please use -Type: Documentation-only +Type: Runtime The [`util.isArray()`][] API is deprecated. Please use `Array.isArray()` instead. diff --git a/lib/util.js b/lib/util.js index e1f005369d5873..2bb310830fbf3c 100644 --- a/lib/util.js +++ b/lib/util.js @@ -388,7 +388,9 @@ module.exports = { getSystemErrorName, inherits, inspect, - isArray: ArrayIsArray, + isArray: deprecate(ArrayIsArray, + 'The `util.isArray` API is deprecated. Please use `Array.isArray()` instead.', + 'DEP0044'), isBoolean, isBuffer, isDeepStrictEqual(a, b) { From cc52b69e2ec35bf6eaf03310e4600d5ccbd103d8 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 12:37:55 +0200 Subject: [PATCH 03/18] util: runtime deprecation util.isBoolean --- doc/api/deprecations.md | 5 ++++- lib/util.js | 6 ++++-- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index b0f363316cd946..244a4a817969ae 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -988,6 +988,9 @@ instead. -Type: Documentation-only +Type: Runtime The [`util.isBoolean()`][] API is deprecated. diff --git a/lib/util.js b/lib/util.js index 2bb310830fbf3c..91485e305305e9 100644 --- a/lib/util.js +++ b/lib/util.js @@ -391,8 +391,10 @@ module.exports = { isArray: deprecate(ArrayIsArray, 'The `util.isArray` API is deprecated. Please use `Array.isArray()` instead.', 'DEP0044'), - isBoolean, - isBuffer, + isBoolean: deprecate(isBoolean, + 'The `util.isBoolean` API is deprecated. Please use `typeof arg === "boolean"` instead.', + 'DEP0045'), + isBuffer: deprecate(isBuffer, 'The `util.isBuffer API is deprecated.', 'DEP0046'), isDeepStrictEqual(a, b) { if (internalDeepEqual === undefined) { internalDeepEqual = require('internal/util/comparisons') From e0bd8b8bf04a17e2b96ffb23befe096dffb83f77 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 12:43:12 +0200 Subject: [PATCH 04/18] util: runtime deprecation util.isBuffer --- doc/api/deprecations.md | 5 ++++- lib/util.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 244a4a817969ae..6652e66a7b8345 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1011,6 +1011,9 @@ The [`util.isBoolean()`][] API is deprecated. -Type: Documentation-only +Type: Runtime The [`util.isBuffer()`][] API is deprecated. Please use [`Buffer.isBuffer()`][] instead. diff --git a/lib/util.js b/lib/util.js index 91485e305305e9..82ae63eb841d53 100644 --- a/lib/util.js +++ b/lib/util.js @@ -394,7 +394,9 @@ module.exports = { isBoolean: deprecate(isBoolean, 'The `util.isBoolean` API is deprecated. Please use `typeof arg === "boolean"` instead.', 'DEP0045'), - isBuffer: deprecate(isBuffer, 'The `util.isBuffer API is deprecated.', 'DEP0046'), + isBuffer: deprecate(isBuffer, + 'The `util.isBuffer` API is deprecated. Please use `Buffer.isBuffer()` instead.', + 'DEP0046'), isDeepStrictEqual(a, b) { if (internalDeepEqual === undefined) { internalDeepEqual = require('internal/util/comparisons') From dca7282794623234c9041d92ad21ea326fcbe05f Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 12:44:51 +0200 Subject: [PATCH 05/18] util: runtime deprecate util.isDate --- doc/api/deprecations.md | 5 ++++- lib/util.js | 45 +++++++++++++++++++++++++++++------------ 2 files changed, 36 insertions(+), 14 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 6652e66a7b8345..557e924d0ba658 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1035,6 +1035,9 @@ The [`util.isBuffer()`][] API is deprecated. Please use -Type: Documentation-only +Type: Runtime The [`util.isDate()`][] API is deprecated. diff --git a/lib/util.js b/lib/util.js index 82ae63eb841d53..4f66b9ee8f9dc5 100644 --- a/lib/util.js +++ b/lib/util.js @@ -404,19 +404,38 @@ module.exports = { } return internalDeepEqual(a, b); }, - isNull, - isNullOrUndefined, - isNumber, - isString, - isSymbol, - isUndefined, - isRegExp: types.isRegExp, - isObject, - isDate: types.isDate, - isError, - isFunction, - isPrimitive, - log, + isNull: deprecate(isNull, + 'The `util.isNull` API is deprecated. Please use `arg === null` instead.', + 'DEP0050'), + isNullOrUndefined: deprecate(isNullOrUndefined, + 'The `util.isNullOrUndefined` API is deprecated. ' + + 'Please use `arg === null || arg === undefined` instead.', + 'DEP0051'), + isNumber: deprecate(isNumber, + 'The `util.isNumber` API is deprecated. Please use `typeof arg === "number"` instead.', + 'DEP0052'), + isString: deprecate(isString, + 'The `util.isString` API is deprecated. Please use `typeof arg === "string"` instead.', + 'DEP0056'), + isSymbol: deprecate(isSymbol, + 'The `util.isSymbol` API is deprecated. Please use `arg === "symbol"` instead.', + 'DEP0057'), + isUndefined: deprecate(isUndefined, + 'The `util.isUndefined` API is deprecated. Please use `arg === undefined` instead.', + 'DEP0058'), + isRegExp: deprecate(types.isRegExp, + '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.', + 'DEP0053'), + isDate: deprecate(types.isDate, + 'The `util.isDate` API is deprecated. Please use `arg instanceof Error` instead.', + 'DEP0047'), + isError: deprecate(isError, 'The `util.isError API is deprecated.', 'DEP0048'), + isFunction: deprecate(isFunction, 'The `util.isFunction API is deprecated.', 'DEP0049'), + isPrimitive: deprecate(isPrimitive, 'The `util.isPrimitive API is deprecated.', 'DEP0054'), + log: deprecate(log, 'The `util.log API is deprecated.', 'DEP0059'), promisify, stripVTControlCharacters, toUSVString, From f2d35a3d87d7bc93d38c69a7d54d1fd6019ea0a2 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 12:46:05 +0200 Subject: [PATCH 06/18] util: runtime deprecate util.isError --- doc/api/deprecations.md | 9 +++++++-- lib/util.js | 8 ++++++-- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 557e924d0ba658..d7ae0bae83630b 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1058,6 +1058,9 @@ The [`util.isDate()`][] API is deprecated. -Type: Documentation-only +Type: Runtime -The [`util.isError()`][] API is deprecated. +The [`util.isError()`][] API is deprecated. Please use +`Object.prototype.toString(arg) === '[object Error]' || arg instanceof Error` +instead. ### DEP0049: `util.isFunction()` diff --git a/lib/util.js b/lib/util.js index 4f66b9ee8f9dc5..12b9c5d7c670c5 100644 --- a/lib/util.js +++ b/lib/util.js @@ -430,9 +430,13 @@ module.exports = { 'The `util.isObject` API is deprecated. Please use `typeof arg === "object"` instead.', 'DEP0053'), isDate: deprecate(types.isDate, - 'The `util.isDate` API is deprecated. Please use `arg instanceof Error` instead.', + 'The `util.isDate API is deprecated. Please use `arg instanceof Error` instead.', 'DEP0047'), - isError: deprecate(isError, 'The `util.isError API is deprecated.', 'DEP0048'), + isError: deprecate(isError, + 'The `util.isError` API is deprecated. ' + + 'Please use `ObjectPrototypeToString(e) === "[object Error]" ' + + '|| e instanceof Error` instead.', + 'DEP0048'), isFunction: deprecate(isFunction, 'The `util.isFunction API is deprecated.', 'DEP0049'), isPrimitive: deprecate(isPrimitive, 'The `util.isPrimitive API is deprecated.', 'DEP0054'), log: deprecate(log, 'The `util.log API is deprecated.', 'DEP0059'), From 1c1745ba224ca7d01efa43887d7df79325afb034 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 12:48:45 +0200 Subject: [PATCH 07/18] util: runtime deprecate util.isFunction --- doc/api/deprecations.md | 5 ++++- lib/util.js | 4 +++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index d7ae0bae83630b..cabafd85a90116 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1083,6 +1083,9 @@ instead. -Type: Documentation-only +Type: Runtime The [`util.isFunction()`][] API is deprecated. diff --git a/lib/util.js b/lib/util.js index 12b9c5d7c670c5..00b132934d9b32 100644 --- a/lib/util.js +++ b/lib/util.js @@ -437,7 +437,9 @@ module.exports = { 'Please use `ObjectPrototypeToString(e) === "[object Error]" ' + '|| e instanceof Error` instead.', 'DEP0048'), - isFunction: deprecate(isFunction, 'The `util.isFunction API is deprecated.', 'DEP0049'), + isFunction: deprecate(isFunction, + 'The `util.isFunction` API is deprecated. Please use `typeof arg === "function"` instead.', + 'DEP0049'), isPrimitive: deprecate(isPrimitive, 'The `util.isPrimitive API is deprecated.', 'DEP0054'), log: deprecate(log, 'The `util.log API is deprecated.', 'DEP0059'), promisify, From 8d98dd0130981f75afb8e68627c0321141748972 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 12:50:30 +0200 Subject: [PATCH 08/18] util: runtime deprecate util.isNull --- doc/api/deprecations.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index cabafd85a90116..1ca3f3a54b82dd 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1106,6 +1106,9 @@ The [`util.isFunction()`][] API is deprecated. -Type: Documentation-only +Type: Runtime The [`util.isNull()`][] API is deprecated. From b14723b7773e23716ab7ff43d876a950047d9404 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 12:51:34 +0200 Subject: [PATCH 09/18] util: runtime deprecate util.isNullOrUndefined --- doc/api/deprecations.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 1ca3f3a54b82dd..de134a96fd1c63 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1129,6 +1129,9 @@ The [`util.isNull()`][] API is deprecated. -Type: Documentation-only +Type: Runtime The [`util.isNullOrUndefined()`][] API is deprecated. From a00fdd9909b2793d16c07c534a92e6e1ed50eac5 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 12:54:26 +0200 Subject: [PATCH 10/18] util: runtime deprecate util.isNumber --- doc/api/deprecations.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index de134a96fd1c63..31d55299908273 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1152,6 +1152,9 @@ The [`util.isNullOrUndefined()`][] API is deprecated. -Type: Documentation-only +Type: Runtime The [`util.isNumber()`][] API is deprecated. From b2c09ced2b2f80d19f620b6a2c87165d23499d11 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 12:55:32 +0200 Subject: [PATCH 11/18] util: runtime deprecate util.isObject --- 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 31d55299908273..bd872e95823508 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.', From 58a1e2555dfb184922c71712a1656f8f8e5dc2e0 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 12:57:14 +0200 Subject: [PATCH 12/18] util: runtime deprecate util.isPrimitive --- doc/api/deprecations.md | 5 ++++- lib/util.js | 6 +++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index bd872e95823508..264c4d05e7a39c 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1198,6 +1198,9 @@ The [`util.isObject()`][] API is deprecated. -Type: Documentation-only +Type: Runtime The [`util.isPrimitive()`][] API is deprecated. diff --git a/lib/util.js b/lib/util.js index eca8ecb980e7a4..fbcacfa8228655 100644 --- a/lib/util.js +++ b/lib/util.js @@ -441,7 +441,11 @@ module.exports = { isFunction: deprecate(isFunction, 'The `util.isFunction` API is deprecated. Please use `typeof arg === "function"` instead.', 'DEP0049'), - isPrimitive: deprecate(isPrimitive, 'The `util.isPrimitive API is deprecated.', 'DEP0054'), + isPrimitive: deprecate(isPrimitive, + 'The `util.isPrimitive` API is deprecated. ' + + 'Please use `arg === null || ' + + '(typeof arg !== "object" && typeof arg !== "function")` instead.', + 'DEP0054'), log: deprecate(log, 'The `util.log API is deprecated.', 'DEP0059'), promisify, stripVTControlCharacters, From d1bc34b2b4fc49da31e93f6a63c393fde0629801 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 12:58:40 +0200 Subject: [PATCH 13/18] util: runtime deprecate util.isRegExp --- doc/api/deprecations.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 264c4d05e7a39c..1c0c791eab7160 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1221,6 +1221,9 @@ The [`util.isPrimitive()`][] API is deprecated. -Type: Documentation-only +Type: Runtime The [`util.isRegExp()`][] API is deprecated. From fd492e16f5f6626aae00229bd1c2b148fb06ff81 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 13:00:24 +0200 Subject: [PATCH 14/18] util: runtime deprecate util.isString --- doc/api/deprecations.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 1c0c791eab7160..e2c531f9ec142f 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1244,6 +1244,9 @@ The [`util.isRegExp()`][] API is deprecated. -Type: Documentation-only +Type: Runtime The [`util.isString()`][] API is deprecated. From e8a7ae2d9e13b0dfeea572064fb1db25514b7117 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 13:02:20 +0200 Subject: [PATCH 15/18] util: runtime deprecate util.isSymbol --- doc/api/deprecations.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index e2c531f9ec142f..58b914e466a42b 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1267,6 +1267,9 @@ The [`util.isString()`][] API is deprecated. -Type: Documentation-only +Type: Runtime The [`util.isSymbol()`][] API is deprecated. From e067d7eb88f4a15775d6222490e8f2e8b8e6851e Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 13:03:27 +0200 Subject: [PATCH 16/18] util: runtime deprecate util.isUndefined --- doc/api/deprecations.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index 58b914e466a42b..f9c3e67518a53d 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1290,6 +1290,9 @@ The [`util.isSymbol()`][] API is deprecated. -Type: Documentation-only +Type: Runtime The [`util.isUndefined()`][] API is deprecated. From c5e63a1c1826612cafab583cae55a5085f7ac054 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 13:04:21 +0200 Subject: [PATCH 17/18] util: runtime deprecate util.log fix pr url --- doc/api/deprecations.md | 5 ++++- lib/util.js | 5 ++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index f9c3e67518a53d..f8a9b4909759b7 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1313,6 +1313,9 @@ The [`util.isUndefined()`][] API is deprecated. -Type: Documentation-only +Type: Runtime The [`util.log()`][] API is deprecated. diff --git a/lib/util.js b/lib/util.js index fbcacfa8228655..0e8a79d2b35eae 100644 --- a/lib/util.js +++ b/lib/util.js @@ -446,7 +446,10 @@ module.exports = { 'Please use `arg === null || ' + '(typeof arg !== "object" && typeof arg !== "function")` instead.', 'DEP0054'), - log: deprecate(log, 'The `util.log API is deprecated.', 'DEP0059'), + log: deprecate(log, + 'The `util.log API is deprecated. ' + + 'Please use console.log() with a custom formatter or a third-party logger instead.', + 'DEP0059'), promisify, stripVTControlCharacters, toUSVString, From 6bed94f10703a85e9dab8b0e4a02f98e24d8d779 Mon Sep 17 00:00:00 2001 From: Marco Ippolito Date: Tue, 31 Oct 2023 15:37:19 +0200 Subject: [PATCH 18/18] doc: add migration paths for deprecated utils --- doc/api/deprecations.md | 53 ++++++++++++++++++++++++++++++----------- lib/util.js | 2 +- 2 files changed, 40 insertions(+), 15 deletions(-) diff --git a/doc/api/deprecations.md b/doc/api/deprecations.md index f8a9b4909759b7..ce2872a3a9896e 100644 --- a/doc/api/deprecations.md +++ b/doc/api/deprecations.md @@ -1005,7 +1005,8 @@ changes: Type: Runtime -The [`util.isBoolean()`][] API is deprecated. +The [`util.isBoolean()`][] API is deprecated. Please use +`typeof arg === 'boolean'` instead. ### DEP0046: `util.isBuffer()` @@ -1052,7 +1053,8 @@ changes: Type: Runtime -The [`util.isDate()`][] API is deprecated. +The [`util.isDate()`][] API is deprecated. Please use +`arg instanceof Date` instead. ### DEP0048: `util.isError()` @@ -1100,7 +1102,8 @@ changes: Type: Runtime -The [`util.isFunction()`][] API is deprecated. +The [`util.isFunction()`][] API is deprecated. Please use +`typeof arg === 'function'` instead. ### DEP0050: `util.isNull()` @@ -1123,7 +1126,8 @@ changes: Type: Runtime -The [`util.isNull()`][] API is deprecated. +The [`util.isNull()`][] API is deprecated. Please use +`arg === null` instead. ### DEP0051: `util.isNullOrUndefined()` @@ -1146,7 +1150,8 @@ changes: Type: Runtime -The [`util.isNullOrUndefined()`][] API is deprecated. +The [`util.isNullOrUndefined()`][] API is deprecated. Please use +`arg === null || arg === undefined` instead. ### DEP0052: `util.isNumber()` @@ -1169,7 +1174,8 @@ changes: Type: Runtime -The [`util.isNumber()`][] API is deprecated. +The [`util.isNumber()`][] API is deprecated. Please use +`typeof arg === 'number'` instead. ### DEP0053: `util.isObject()` @@ -1192,7 +1198,8 @@ changes: Type: Runtime -The [`util.isObject()`][] API is deprecated. +The [`util.isObject()`][] API is deprecated. Please use +`arg && typeof arg === 'object'` instead. ### DEP0054: `util.isPrimitive()` @@ -1215,7 +1222,9 @@ changes: Type: Runtime -The [`util.isPrimitive()`][] API is deprecated. +The [`util.isPrimitive()`][] API is deprecated. Please use +`arg === null || (typeof arg !=='object' && typeof arg !== 'function')` +instead. ### DEP0055: `util.isRegExp()` @@ -1238,7 +1247,8 @@ changes: Type: Runtime -The [`util.isRegExp()`][] API is deprecated. +The [`util.isRegExp()`][] API is deprecated. Please use +`arg instanceof RegExp` instead. ### DEP0056: `util.isString()` @@ -1261,7 +1271,8 @@ changes: Type: Runtime -The [`util.isString()`][] API is deprecated. +The [`util.isString()`][] API is deprecated. Please use +`typeof arg === 'string'` instead. ### DEP0057: `util.isSymbol()` @@ -1284,7 +1295,8 @@ changes: Type: Runtime -The [`util.isSymbol()`][] API is deprecated. +The [`util.isSymbol()`][] API is deprecated. Please use +`typeof arg === 'symbol'` instead. ### DEP0058: `util.isUndefined()` @@ -1307,7 +1319,8 @@ changes: Type: Runtime -The [`util.isUndefined()`][] API is deprecated. +The [`util.isUndefined()`][] API is deprecated. Please use +`arg === undefined` instead. ### DEP0059: `util.log()` @@ -1326,7 +1339,17 @@ changes: Type: Runtime -The [`util.log()`][] API is deprecated. +The [`util.log()`][] API has been deprecated because it's an unmaintained +legacy API that was exposed to user land by accident. Instead, +consider the following alternatives based on your specific needs: + +* **Third-Party Logging Libraries** + +* **Use `console.log(new Date().toLocaleString(), message)`** + +By adopting one of these alternatives, you can transition away from `util.log()` +and choose a logging strategy that aligns with the specific +requirements and complexity of your application. ### DEP0060: `util._extend()` @@ -1345,7 +1368,9 @@ changes: Type: Runtime -The [`util._extend()`][] API is deprecated. +The [`util._extend()`][] API is deprecated because it's an unmaintained +legacy API that was exposed to user land by accident. +Please use `target = Object.assign(target, source)` instead. ### DEP0061: `fs.SyncWriteStream` diff --git a/lib/util.js b/lib/util.js index 0e8a79d2b35eae..b882ef304096a3 100644 --- a/lib/util.js +++ b/lib/util.js @@ -431,7 +431,7 @@ module.exports = { '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.', + 'The `util.isDate` API is deprecated. Please use `arg instanceof Date` instead.', 'DEP0047'), isError: deprecate(isError, 'The `util.isError` API is deprecated. ' +