# completion-array

> creates list of switches and invoke callback after all switches get switched

Latest version **2.2.7** (published 2022-11-02) · MIT license · 0 weekly downloads

## Install

```sh
npm install completion-array
pnpm add completion-array
yarn add completion-array
bun add completion-array
```

## 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.7 |
| Published | 2022-11-02 |
| First published | 2022-10-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 8.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | ynoplanetashka |
| Maintainers | ynoplanetashka |
| Keywords | completion, array |

## Links

- npm: https://www.npmjs.com/package/completion-array
- Repository: https://github.com/ynoplanetashka2/completion-array
- Homepage: https://github.com/ynoplanetashka2/completion-array#readme
- Issues: https://github.com/ynoplanetashka2/completion-array/issues
- npm.io page: https://npm.io/package/completion-array

## Recent versions

- 2.2.7 (latest) — 2022-11-02
- 2.2.5 — 2022-10-29
- 2.2.4 — 2022-10-29
- 2.2.3 — 2022-10-29
- 2.2.2 — 2022-10-29
- 2.2.1 — 2022-10-29
- 2.2.0 — 2022-10-29
- 2.1.2 — 2022-10-29
- 2.1.1 — 2022-10-29
- 2.1.0 — 2022-10-29
- 2.0.0 — 2022-10-29

## README

# completion-array

Creates list of switches and invoke callback after all switches get switched
## api

`createCompletionArray` :
```js
import { createCompletionArray } from 'completion-array';

const [complete0, complete1] = createCompletionArray(2, () => console.log('all items completed'));

complete0()
complete0()
// nothing happend

complete1()
// logs: 'all items completed'

complete1()
complete0()
// nothing happend
```
`createCompletionFn` :
```js
import { createCompletionFn } from 'completion-array';

const complete = createCompletionFn(2, () => console.log('all items completed'));

complete(0)
complete(0)
// nothing happend

complete(1)
// logs: 'all items completed'

complete(1)
complete(0)
// nothing happend
```

Also you can check src/\_\_tests\_\_ in git repo for more examples.
## use case
Say your code needs to save completion state of a list of elements, and after all the elements are completed, perform some action. It's exactly the reason behind creation of this package.

## Author
email:
mrynoplanetashka@gmail.com

## License
MIT (See `LICENSE` for more info)

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