Skip to content
This repository has been archived by the owner on Apr 22, 2023. It is now read-only.

Commit

Permalink
doc: add spec for util.deprecate()
Browse files Browse the repository at this point in the history
Signed-off-by: Trevor Norris <trev.norris@gmail.com>
  • Loading branch information
yorkie authored and trevnorris committed May 7, 2014
1 parent f10fd1d commit a4f2f9e
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions doc/api/util.markdown
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,21 @@ through the `constructor.super_` property.
stream.write("It works!"); // Received data: "It works!"


## util.deprecate(function, string)

Marks that a method should not be used any more.

exports.puts = exports.deprecate(function() {
for (var i = 0, len = arguments.length; i < len; ++i) {
process.stdout.write(arguments[i] + '\n');
}
}, 'util.puts: Use console.log instead')

It returns a modified function which warns once by default. If
`--no-deprecation` is set then this function is a NO-OP. If
`--throw-deprecation` is set then the application will throw an exception
if the deprecated API is used.

## util.debug(string)

Stability: 0 - Deprecated: use console.error() instead.
Expand Down

0 comments on commit a4f2f9e

Please sign in to comment.