# warn-once

> Show a warning once

Latest version **0.1.1** (published 2022-08-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install warn-once
pnpm add warn-once
yarn add warn-once
bun add warn-once
```

## Health

**Score 20/100 (F)** — status: abandoned.

Positive: has types; no vulnerabilities.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.1.1 |
| Published | 2022-08-07 |
| First published | 2021-03-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 2.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 9 |
| Author | Satyajit Sahoo |
| Maintainers | satya164 |

## Links

- npm: https://www.npmjs.com/package/warn-once
- Repository: https://github.com/satya164/warn-once
- Homepage: https://github.com/satya164/warn-once#readme
- Issues: https://github.com/satya164/warn-once/issues
- npm.io page: https://npm.io/package/warn-once

## Recent versions

- 0.1.1 (latest) — 2022-08-07
- 0.1.0 — 2021-05-09
- 0.0.1 — 2021-03-09

## README

# warn-once

Print a warning exactly once during development. Suitable for deprecation warnings, warnings for missing setup etc.

## Installation

Open a Terminal in the project root and run:

```sh
npm install warn-once
```

## Usage

The `warnOnce` function accepts a condition as the first argument. If the condition is `true`, then it'll print a warning:

```js
const warnOnce = require('warn-once');

// ...

warnOnce(someCondition, 'This is a warning message');
```

You can call `warnOnce` multiple times, but if the warning was printed already, it'll not be printed again.

The warning is only shown during development, i.e. if `NODE_ENV` is not set to `'production'`.

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