diff options
author | Daniel Baumann <daniel@debian.org> | 2024-10-20 23:07:42 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2024-11-09 15:38:42 +0100 |
commit | 714c83b2736d7e308bc33c49057952490eb98be2 (patch) | |
tree | 1d9ba7035798368569cd49056f4d596efc908cd8 /pkg/runner/testdata/actions/node20/node_modules/deprecation/README.md | |
parent | Initial commit. (diff) | |
download | forgejo-act-debian.tar.xz forgejo-act-debian.zip |
Adding upstream version 1.21.4.HEADupstream/1.21.4upstreamdebian
Signed-off-by: Daniel Baumann <daniel@debian.org>
Diffstat (limited to 'pkg/runner/testdata/actions/node20/node_modules/deprecation/README.md')
-rw-r--r-- | pkg/runner/testdata/actions/node20/node_modules/deprecation/README.md | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/pkg/runner/testdata/actions/node20/node_modules/deprecation/README.md b/pkg/runner/testdata/actions/node20/node_modules/deprecation/README.md new file mode 100644 index 0000000..648809d --- /dev/null +++ b/pkg/runner/testdata/actions/node20/node_modules/deprecation/README.md @@ -0,0 +1,77 @@ +# deprecation + +> Log a deprecation message with stack + +![build](https://action-badges.now.sh/gr2m/deprecation) + +## Usage + +<table> +<tbody valign=top align=left> +<tr><th> +Browsers +</th><td width=100%> + +Load `deprecation` directly from [cdn.pika.dev](https://cdn.pika.dev) + +```html +<script type="module"> + import { Deprecation } from "https://cdn.pika.dev/deprecation/v2"; +</script> +``` + +</td></tr> +<tr><th> +Node +</th><td> + +Install with `npm install deprecation` + +```js +const { Deprecation } = require("deprecation"); +// or: import { Deprecation } from "deprecation"; +``` + +</td></tr> +</tbody> +</table> + +```js +function foo() { + bar(); +} + +function bar() { + baz(); +} + +function baz() { + console.warn(new Deprecation("[my-lib] foo() is deprecated, use bar()")); +} + +foo(); +// { Deprecation: [my-lib] foo() is deprecated, use bar() +// at baz (/path/to/file.js:12:15) +// at bar (/path/to/file.js:8:3) +// at foo (/path/to/file.js:4:3) +``` + +To log a deprecation message only once, you can use the [once](https://www.npmjs.com/package/once) module. + +```js +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(); // logs nothing +``` + +## License + +[ISC](LICENSE) |