deprecated-js

0.0.1 • Public • Published

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

Dependencies (0)

    Dev Dependencies (1)

    Package Sidebar

    Install

    npm i deprecated-js

    Weekly Downloads

    2

    Version

    0.0.1

    License

    MIT

    Last publish

    Collaborators

    • rmcc13