npm.io
1.3.0 • Published 8 years ago

depreca

Licence
MIT
Version
1.3.0
Deps
0
Vulns
0
Weekly
0
Stars
3

depreca

Mark something as deprecated with a simple module.

Installation

Node.js

npm install depreca --save

Example

Just one method!

Deprecate function
const deprecate = require('depreca');

function foo(){
    deprecate('foo() is deprecated use bar() instead'); 
    //=> [DeprecationWarning] foo() is deprecated use bar() instead
}
Deprecate object property
const config = {
    foo: 'hello',
    bar: 'world'
};

deprecate(config.foo, 'foo is deprecated use bar instead'); 
//=> [DeprecationWarning] foo is deprecated use bar instead

// set a custom deprecation title
deprecate.title = 'MyCustomDeprecation';
deprecate(config.bar, 'bar is deprecated use foo instead'); 
//=> [MyCustomDeprecation] bar is deprecated use foo instead
Call only once of deprecate
deprecate.once('foo() is deprecated use bar() instead'); 

Changelog

You can view the changelog here

License

depreca is open-sourced software licensed under the MIT license

Author

Fabio Ricali

Keywords