# deprecation

> Log a deprecation message with stack

Latest version **2.3.1** (published 2019-06-13) · ISC license · 0 weekly downloads

## Install

```sh
npm install deprecation
pnpm add deprecation
yarn add deprecation
bun add deprecation
```

## Health

**Score 40/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 2.3.1 |
| Published | 2019-06-13 |
| First published | 2019-03-06 |
| Weekly downloads | 0 |
| License | ISC |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 3 |
| Maintainers | gr2m |
| Keywords | deprecate, deprecated, deprecation |

## Links

- npm: https://www.npmjs.com/package/deprecation
- Repository: https://github.com/gr2m/deprecation
- Homepage: https://github.com/gr2m/deprecation#readme
- Issues: https://github.com/gr2m/deprecation/issues
- npm.io page: https://npm.io/package/deprecation

## Recent versions

- 2.3.1 (latest) — 2019-06-13
- 2.3.0 — 2019-06-13
- 2.2.0 — 2019-06-13
- 2.1.0 — 2019-06-13
- 2.0.0 — 2019-05-14
- 1.0.1 — 2019-03-06
- 1.0.0 — 2019-03-06

## README

# 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)

---
_Source: https://npm.io/package/deprecation · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
