1.3.0 • Published 6 years ago

depreca v1.3.0

Weekly downloads
419
License
MIT
Repository
github
Last release
6 years ago

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