@@ -107,13 +107,20 @@ environment variable set, then it will not print anything.
107107Multiple comma-separated ` section ` names may be specified in the ` NODE_DEBUG `
108108environment variable. For example: ` NODE_DEBUG=fs,net,tls ` .
109109
110- ## util.deprecate(function, string )
110+ ## util.deprecate(fn, msg [ , code ] )
111111<!-- YAML
112112added: v0.8.0
113113-->
114114
115- The ` util.deprecate() ` method wraps the given ` function ` or class in such a way that
116- it is marked as deprecated.
115+ * ` fn ` {Function} The function that is being deprecated.
116+ * ` msg ` {string} A warning message to display when the deprecated function is
117+ invoked.
118+ * ` code ` {string} A deprecation code. See the [ list of deprecated APIs] [ ] for a
119+ list of codes.
120+ * Returns: {Function} The deprecated function wrapped to emit a warning.
121+
122+ The ` util.deprecate() ` method wraps ` fn ` (which may be a function or class) in
123+ such a way that it is marked as deprecated.
117124
118125<!-- eslint-disable prefer-rest-params -->
119126``` js
@@ -127,10 +134,9 @@ exports.puts = util.deprecate(function() {
127134```
128135
129136When called, ` util.deprecate() ` will return a function that will emit a
130- ` DeprecationWarning ` using the ` process.on('warning') ` event. By default,
131- this warning will be emitted and printed to ` stderr ` exactly once, the first
132- time it is called. After the warning is emitted, the wrapped ` function `
133- is called.
137+ ` DeprecationWarning ` using the ` process.on('warning') ` event. The warning will
138+ be emitted and printed to ` stderr ` exactly once, the first time it is called.
139+ After the warning is emitted, the wrapped function is called.
134140
135141If either the ` --no-deprecation ` or ` --no-warnings ` command line flags are
136142used, or if the ` process.noDeprecation ` property is set to ` true ` * prior* to
@@ -1213,4 +1219,5 @@ Deprecated predecessor of `console.log`.
12131219[ Internationalization ] : intl.html
12141220[ WHATWG Encoding Standard ] : https://encoding.spec.whatwg.org/
12151221[ constructor ] : https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/constructor
1222+ [ list of deprecated APIS ] : deprecations.html#deprecations_list_of_deprecated_apis
12161223[ semantically incompatible ] : https://github.com/nodejs/node/issues/4179
0 commit comments