# just-once

> create a function that can only be invoked once

Latest version **2.2.0** (published 2022-12-17) · MIT license · 0 weekly downloads

## Install

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

## Health

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

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

Warnings: low downloads.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.2.0 |
| Published | 2022-12-17 |
| First published | 2017-08-18 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 6191 |
| Author | Angus Croll |
| Maintainers | angus-c |
| Keywords | function, once, no-dependencies, just |

## Links

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

## Recent versions

- 2.2.0 (latest) — 2022-12-17
- 2.1.1 — 2022-08-08
- 2.1.0 — 2022-08-07
- 2.0.1 — 2021-11-13
- 2.0.0 — 2021-11-09
- 1.4.2 — 2021-11-02
- 1.4.1 — 2021-11-01
- 1.4.0 — 2021-10-31
- 1.3.0 — 2021-10-30
- 1.2.0 — 2021-08-30
- 1.1.1 — 2019-01-13
- 1.1.0 — 2018-08-09
- 1.0.1 — 2017-08-18
- 1.0.0 — 2017-08-18

## README

<!-- DO NOT EDIT THIS FILE! THIS FILE WAS AUTOGENERATED BY TEMPLATE-MATE -->
<!-- SEE https://github.com/angus-c/just/blob/master/CONTRIBUTING.md#readme-template -->

## just-once

Part of a [library](https://anguscroll.com/just) of zero-dependency npm modules that do just do one thing.
Guilt-free utilities for every occasion.

[`🍦 Try it`](https://anguscroll.com/just/just-once)

```shell
npm install just-once
```
```shell
yarn add just-once
```

Create a function that can only be invoked once

```js
import once from 'just-once';

const fn = once(() => console.log('hello'));

fn();
// logs 'hello'
fn();
// does nothing
```

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