@@ -107,13 +107,20 @@ environment variable set, then it will not print anything.
107
107
Multiple comma-separated ` section ` names may be specified in the ` NODE_DEBUG `
108
108
environment variable. For example: ` NODE_DEBUG=fs,net,tls ` .
109
109
110
- ## util.deprecate(function, string )
110
+ ## util.deprecate(fn, msg [ , code ] )
111
111
<!-- YAML
112
112
added: v0.8.0
113
113
-->
114
114
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.
117
124
118
125
<!-- eslint-disable prefer-rest-params -->
119
126
``` js
@@ -127,10 +134,9 @@ exports.puts = util.deprecate(function() {
127
134
```
128
135
129
136
When 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.
134
140
135
141
If either the ` --no-deprecation ` or ` --no-warnings ` command line flags are
136
142
used, or if the ` process.noDeprecation ` property is set to ` true ` * prior* to
@@ -1213,4 +1219,5 @@ Deprecated predecessor of `console.log`.
1213
1219
[ Internationalization ] : intl.html
1214
1220
[ WHATWG Encoding Standard ] : https://encoding.spec.whatwg.org/
1215
1221
[ constructor ] : https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/Object/constructor
1222
+ [ list of deprecated APIS ] : deprecations.html#deprecations_list_of_deprecated_apis
1216
1223
[ semantically incompatible ] : https://github.com/nodejs/node/issues/4179
0 commit comments