# seq-ids

> Generates a sequential ID, which increments by 1 every time you generate it.

Latest version **1.0.1** (published 2020-05-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install seq-ids
pnpm add seq-ids
yarn add seq-ids
bun add seq-ids
```

## Health

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

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2020-05-27 |
| First published | 2020-05-27 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 13.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Splox |
| Maintainers | splox |
| Keywords | sequential, sequid, rolling, id, ids |

## Links

- npm: https://www.npmjs.com/package/seq-ids
- Repository: https://github.com/SploxFox/seq-ids
- Homepage: https://github.com/SploxFox/seq-ids#readme
- Issues: https://github.com/SploxFox/seq-ids/issues
- npm.io page: https://npm.io/package/seq-ids

## Alternatives

- [@sindresorhus/slugify](https://npm.io/package/@sindresorhus/slugify.md) — 3.7M weekly downloads
- [solid-js](https://npm.io/package/solid-js.md) — 2.7M weekly downloads
- [expo-glass-effect](https://npm.io/package/expo-glass-effect.md) — 2.5M weekly downloads
- [nanoassert](https://npm.io/package/nanoassert.md) — 780.8K weekly downloads
- [@ffmpeg/ffmpeg](https://npm.io/package/@ffmpeg/ffmpeg.md) — 529.5K weekly downloads

## Recent versions

- 1.0.1 (latest) — 2020-05-27
- 1.0.0 — 2020-05-27

## README

## Note
This is for things that don't need to be secure at all. If you need something for something like a customer database, please use UUIDs.

## Usage
Basic usage:
```
import SeqIDs from "seq-ids";

const seq = new SeqIDs();

const num = seq.new();
console.log(num); // 0

seq.new(); // == 1
seq.new(); // == 2
```

Also includes the ability to specify a base:
```
const seq = new SeqIDs(16);
```

And the ability to reserve a certain ID:
```
const seq = new SeqIDs(36); // <= IDs generated will use 0-9 and the whole lowercase alphabet

seq.new(); // 0
// ... imagine we call seq.new a bunch of times ...
seq.new(); // 8
seq.new(); // 9
seq.new(); // a
seq.new(); // b
// If seq is called through new SeqIDs(36), it will use all numbers and lowercase letters.

seq.reserve("reserved");
//If seq gets to "reserved", it will skip over it.
```

## Docs

___

**new SeqIDs**(`base`?: *number*)

Creates a new sequential ID generator. `base` is the base to use for IDs (defaults to 10 if omitted).

___

**new**(): *string | number*

Generates a new ID. Will be numeric if outBase is not specified in the constructor
or is 10, otherwise it will be an alphanumeric string.

___

**reserve**(`id`: string | number): *string | number*

Reserves an ID so that it can't be generated. It will just be skipped if the generator gets to it. Returns the ID passed in.

___

**reserve**(`...ids`: (string | number)[]): *(string | number)[]*

Reserves all of the IDs passed in as arguments.

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