# yuid

> ### What is it? `yuid` produces unique ids using javascript generator methods.

Latest version **0.2.2** (published 2020-12-03) · MIT license · 0 weekly downloads

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

## Install

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

## Health

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

Negative: deprecated.

## Facts

| | |
|---|---|
| Version | 0.2.2 |
| Published | 2020-12-03 |
| First published | 2020-11-15 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Node | >=10 |
| Dependencies | 0 |
| Unpacked size | 9 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| Author | Hedzer |
| Maintainers | hedzer |

## Links

- npm: https://www.npmjs.com/package/yuid
- npm.io page: https://npm.io/package/yuid

## Recent versions

- 0.2.2 (latest) — 2020-12-03
- 0.2.1 — 2020-11-15
- 0.2.0 — 2020-11-15

## README

# Yield UID (yuid)

### What is it?
`yuid` produces unique ids using javascript generator methods.

### Goals
1. Extremely small, less than 600 bytes (ES6, non-minified)
2. Non-cryptographic but random enough to not have collisions when used async
3. Has a monotonic component

A generated Id looks like this: "1-khjm3urk-2aru7hqvsdv"

It is composed of: `${serial}-${time}-${random}`

### Installation
```
npm install --save yuid
```

### Usage
```javascript
import yuid from 'yuid';

// using generators
const generator = yuid.generator();  // initialize the generator
const uid = generator.next().value; // pull a uid
```
or, alternatively, you can use a static, pre-instantiated generator provided by the class.
```javascript
import yuid from 'yuid';
const uid = yuid.getId();
```

Instantiating your own generates a new monotonic sequence. Using `getId` shares a global sequence.

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