# @theroyalwhee0/counters

> Wrapping Numeric Counters

Latest version **1.0.0** (published 2022-06-02) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install @theroyalwhee0/counters
pnpm add @theroyalwhee0/counters
yarn add @theroyalwhee0/counters
bun add @theroyalwhee0/counters
```

## Health

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

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

Warnings: low downloads; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.0 |
| Published | 2022-06-02 |
| First published | 2021-01-27 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 33 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Adam Mill |
| Maintainers | theroyalwhee0 |
| Keywords | counter, sequence |

## Links

- npm: https://www.npmjs.com/package/@theroyalwhee0/counters
- Repository: https://github.com/theroyalwhee0/counters
- Homepage: https://github.com/theroyalwhee0/counters#readme
- Issues: https://github.com/theroyalwhee0/counters/issues
- npm.io page: https://npm.io/package/@theroyalwhee0/counters

## Dependencies (1)

- [@theroyalwhee0/istype](https://npm.io/package/@theroyalwhee0/istype.md) 3.0.0

## Recent versions

- 1.0.0 (latest) — 2022-06-02
- 0.0.3 — 2021-03-30
- 0.0.1 — 2021-01-27

## README

# @theroyalwhee0/counters

## Wrapping Numeric Counters
Creates iterable sequences of 8/16/32/53 bits wrapping when the maximum value is exceeded. The sequences start at 1 (instead of 0) to prevent usage errors.

## Installation
`npm install @theroyalwhee0/counters`

*or*

`yarn add @theroyalwhee0/counters`


## Documentation
[API Documentation](https://theroyalwhee0.github.io/counters/)


## Usage
```
const { uint8Counter } = require('./index');
const counter = uint8Counter();
let item = counter.next();
console.log(`${item.value} should be 1`);
item = counter.next();
console.log(`${item.value} should now be 2`);
for(let idx=0; idx < 255; idx++) {
  item = counter.next();
  console.log(`${idx} = ${item.value}`);
}
```

## Testing.
Running ```npm run test``` will run the test suite. Running ```npm run test-watch``` will run the test suite in watch mode.


## Links
- GitHub: https://github.com/theroyalwhee0/counters
- NPM: https://www.npmjs.com/package/@theroyalwhee0/counters


## History
- v1.0.0 - 2022-06-02
  - Bump depends for security.
- v0.0.3 - 2021-03-30
  - Port to TypeScript.
- v0.0.2
  - Change docs to not have date.
- v0.0.1 2021-01-27
  - Initial release.


## Legal & License
Copyright 2021-2022 Adam Mill

This library is released under Apache 2 license. See [LICENSE](https://github.com/theroyalwhee0/dynasty/blob/master/LICENSE) for more details.

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