1.4.0 • Published 9 years ago

deprecate-me v1.4.0

Weekly downloads
8
License
GPL-3.0
Repository
gitlab
Last release
9 years ago

Deprecate-Me

Mark your methods as deprecated, and display messages with some options.

Installation

npm install deprecate-me

Usage

var deprecate = require('deprecate-me');
function test() {
	deprecate(); // A warning will be printed when function test will be called for the first time
	console.warn(deprecate.str()); // Return the warning as a string, that you could display later
}

Several options can be used trought a simple javascript object:

{
	since: '0.2.5', // The function is deprecated since version 0.2.5
	name: 'renamedFunction', // Default is the name of the function where deprecate() is called
	removed: '1.0.0', // The function will be removed in version 1.0.0
	// Note that it will also display the current version, if it can detect it
	current: '0.8.0', // Change value of current version manually
	printOnce: false, // By default, a message is called only the first time you call the function
	// You can avoid this behaviour with this argument
	replaceBy: "toto" // the name of the function you should use instead of the deprecated function
	message: "It's really bad" // This message will be printed in a new line
}

Examples

Some examples are available in example.js.

Author

Emeraude

1.4.0

9 years ago

1.3.1

10 years ago

1.3.0

10 years ago

1.2.2

10 years ago

1.2.1

10 years ago

1.2.0

10 years ago

1.1.3

10 years ago

1.1.2

10 years ago

1.1.1

10 years ago

1.1.0

10 years ago

1.0.0

10 years ago