# random-id-gen

> Generate a random id string with a prefix and allows to configurate the chars and length

Latest version **0.2.0** (published 2021-07-05) · MIT license · 0 weekly downloads

## Install

```sh
npm install random-id-gen
pnpm add random-id-gen
yarn add random-id-gen
bun add random-id-gen
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.2.0 |
| Published | 2021-07-05 |
| First published | 2021-06-06 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 3.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Jesús Gándara Martínez |
| Maintainers | jesusgm |
| Keywords | random, identifier, unique |

## Links

- npm: https://www.npmjs.com/package/random-id-gen
- Repository: https://github.com/jesusgm/random-id-gen
- Homepage: https://github.com/jesusgm/random-id-gen#readme
- Issues: https://github.com/jesusgm/random-id-gen/issues
- npm.io page: https://npm.io/package/random-id-gen

## 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

- 0.2.0 (latest) — 2021-07-05
- 0.1.0 — 2021-06-06

## README

# random-id-gen

Generate a random id with customizable prefix, sufix, length and chars

## Instalation

```bash
    npm install random-id-gen --save
```

## Use

```javascript
const id = rig(config);
```

Config is a object with the next default values:

```json
{
  "prefix": "",
  "sufix": "",
  "length": 25,
  "letters": "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ",
  "numbers": "0123456789",
  "specialChars": "-_+!&@%=¿?¡!"
}
```

You can combine as you want

## Examples of use

```javascript
import rig from "random-id-gen";

//default id
const id = rig();
console.log(id); //WrDxw27xyb_w@8UFTy_0TGfrR

//custom length
const id = rig({ length: 10 });
console.log(id); //hh4-rRedj?

//no letters
const id = rig({ letters: "" });
console.log(id); //!&0_5@978_

//no special chars
const id = rig({ specialChars: "" });
console.log(id); //XAe7NSsz8p
```

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