An open API service indexing awesome lists of open source software.

https://github.com/steve-232/generate-unique-id

Generate a unique random ID string.
https://github.com/steve-232/generate-unique-id

javascript random-id unique-id

Last synced: 5 months ago
JSON representation

Generate a unique random ID string.

Awesome Lists containing this project

README

          

# Generate Unique ID
Generate a unique random ID string. GUI demo can be found [here](https://steve-232.github.io/generate-unique-id/).
## Installation
Using npm:
```js
npm i generate-unique-id
```

Using yarn:
```js
yarn add generate-unique-id
```

Using classic "src"
```html

```

## Usage
```js
const generateUniqueId = require('generate-unique-id');

// example 1
const id1 = generateUniqueId();

// example 2
const id2 = generateUniqueId({
length: 32,
useLetters: false
});

// example 3
const id3 = generateUniqueId({
includeSymbols: ['@','#','|'],
excludeSymbols: ['0']
});
```

## Options


Option
Type
Default
Description


length
number
20
Length of the generated ID.


useLetters
boolean
true
Use letters (English alphabet) as part of the generated ID.


useNumbers
boolean
true
Use numbers as part of the generated ID.


includeSymbols
array
[]
Use additional letters as part of the generated ID.


excludeSymbols
array
[]
Do not use these symbols as part of the generated ID.

## License
[MIT license](http://www.opensource.org/licenses/MIT)