Skip to content

Commit

Permalink
util: runtime deprecate util.isDate
Browse files Browse the repository at this point in the history
PR-URL: #50488
Reviewed-By: Rafael Gonzaga <rafael.nunu@hotmail.com>
Reviewed-By: Yagiz Nizipli <yagiz.nizipli@sentry.io>
Reviewed-By: Robert Nagy <ronagy@icloud.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
  • Loading branch information
marco-ippolito authored and nodejs-github-bot committed Nov 27, 2023
1 parent 3c670cb commit a0c5b87
Show file tree
Hide file tree
Showing 2 changed files with 36 additions and 14 deletions.
5 changes: 4 additions & 1 deletion doc/api/deprecations.md
Original file line number Diff line number Diff line change
Expand Up @@ -1035,6 +1035,9 @@ The [`util.isBuffer()`][] API is deprecated. Please use

<!-- YAML
changes:
- version: REPLACEME
pr-url: https://github.com/nodejs/node/pull/50488
description: Runtime deprecation.
- version:
- v6.12.0
- v4.8.6
Expand All @@ -1047,7 +1050,7 @@ changes:
description: Documentation-only deprecation.
-->

Type: Documentation-only
Type: Runtime

The [`util.isDate()`][] API is deprecated.

Expand Down
45 changes: 32 additions & 13 deletions lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down

0 comments on commit a0c5b87

Please sign in to comment.