deprecation
Log a deprecation message with stack
Usage
Browsers
|
Load deprecation directly from cdn.pika.dev
<script type="module">
import { Deprecation } from "https://cdn.pika.dev/deprecation/v2";
</script>
|
---|
Node
|
Install with npm install deprecation
const { Deprecation } = require("deprecation");
|
---|
function foo() {
bar();
}
function bar() {
baz();
}
function baz() {
console.warn(new Deprecation("[my-lib] foo() is deprecated, use bar()"));
}
foo();
To log a deprecation message only once, you can use the once module.
const Deprecation = require("deprecation");
const once = require("once");
const deprecateFoo = once(console.warn);
function foo() {
deprecateFoo(new Deprecation("[my-lib] foo() is deprecated, use bar()"));
}
foo();
foo();
License
ISC