# sequid

> A tiny tool to produce sequential numeric IDs.

Latest version **1.0.1** (published 2019-03-04) · MIT license · 0 weekly downloads

> **Deprecated.** This package is deprecated.

## Install

```sh
npm install sequid
pnpm add sequid
yarn add sequid
bun add sequid
```

## Health

**Score 10/100 (F)** — status: deprecated.

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2019-03-04 |
| First published | 2019-03-04 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 4.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Ayon Lee |
| Maintainers | hyurl |
| Keywords | sequential, id, number, numeric |

## Links

- npm: https://www.npmjs.com/package/sequid
- Repository: https://github.com/hyurl/sequid
- Homepage: https://github.com/hyurl/sequid#readme
- Issues: https://github.com/hyurl/sequid/issues
- npm.io page: https://npm.io/package/sequid

## 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) — 2019-03-04
- 1.0.0 — 2019-03-04

## README

# Sequid

**A tiny tool to produce sequential numeric IDs.**

```typescript
import sequid from "sequid";
import * as assert from "assert";

var seq = sequid();

assert.strictEqual(seq.next().value, 1);
assert.strictEqual(seq.next().value, 2);
assert.strictEqual(seq.next().value, 3);

var seq2 = sequid(Number.MAX_SAFE_INTEGER - 3);

assert.strictEqual(seq2.next().value, Number.MAX_SAFE_INTEGER - 2);
assert.strictEqual(seq2.next().value, Number.MAX_SAFE_INTEGER - 1);
assert.strictEqual(seq2.next().value, Number.MAX_SAFE_INTEGER);
assert.strictEqual(seq2.next().value, undefined);

var seq3 = sequid(Number.MAX_SAFE_INTEGER - 3, true);

assert.strictEqual(seq3.next().value, Number.MAX_SAFE_INTEGER - 2);
assert.strictEqual(seq3.next().value, Number.MAX_SAFE_INTEGER - 1);
assert.strictEqual(seq3.next().value, Number.MAX_SAFE_INTEGER);
assert.strictEqual(seq3.next().value, Number.MAX_SAFE_INTEGER - 2);

console.log("#### OK ####");
```

## API

```typescript
function sequid(offset?: number, loop?: boolean): IterableIterator<number>
```

If `offset` is provided, the sequence will produce the first id started from the
next number of the offset. If the id reaches `Number.MAX_SAFE_INTEGER`, judging
by the `loop` argument, the iterator may restart from the very offset, or break
the sequence and quit iterating.

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