depreca

1.3.0 • Public • Published

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

Package Sidebar

Install

npm i depreca

Weekly Downloads

123

Version

1.3.0

License

MIT

Last publish

Collaborators

  • fabioricali