0.0.1 • Published 8 years ago

deprecated-js v0.0.1

Weekly downloads
4
License
MIT
Repository
github
Last release
8 years ago

deprecated

deprecated is a function decorator that can be used to mark functions and methods as deprecated. deprecated serves the same purpose as the deprecate with some differences.

Using a decorator gives you the ability to mark a function as deprecated without having to change the function's code. Simply pass a message and a function to deprecated and you get a new function that will now warn users it is deprecated when called. deprecated does not change the signature of your functions and you can continue to use them like you did before.

deprecated using console.log instead of a stream so that it can be used in node and browsers.

usage

var deprecated = require('deprecated');

function add(lhs, rhs) {
  return lhs + rhs;
}

console.log(add(1, 3));
>> 4

var deprecatedAdd = deprecated('The add function will be removed in v2.', add);

console.log(deprecatedAdd(1, 3));
>> WARNING!
>> The add function will be removed in v2.
>> 4