diff --git a/doc/api/util.md b/doc/api/util.md index 477e91f2680770..ac298907015189 100644 --- a/doc/api/util.md +++ b/doc/api/util.md @@ -239,6 +239,23 @@ The `--throw-deprecation` command-line flag and `process.throwDeprecation` property take precedence over `--trace-deprecation` and `process.traceDeprecation`. +## `util.deprecate.isDeprecated` + +After a function is deprecated with `util.deprecate`, a symbol is attached to +mark the function's deprecation + +```js +const util = require('node:util'); + +const fn1 = util.deprecate(someFunction, someMessage, 'DEP0001'); +const fn2 = () => {}; + +fn1[util.deprecate.isDeprecated]; // true +fn2[util.deprecate.isDeprecated]; // undefined +``` + ## `util.format(format[, ...args])` + +> Stability: 2 - Stable + +* `object` {any} +* Returns: {boolean} + +Returns `true` if the given `object` was deprecated via `util.deprecate` +otherwise, returns `false`. + ### `util.isError(object)`