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.
- Host: GitHub
- URL: https://github.com/steve-232/generate-unique-id
- Owner: steve-232
- Created: 2018-04-30T18:21:39.000Z (about 8 years ago)
- Default Branch: master
- Last Pushed: 2023-08-07T16:41:16.000Z (almost 3 years ago)
- Last Synced: 2025-10-25T06:20:33.550Z (8 months ago)
- Topics: javascript, random-id, unique-id
- Language: HTML
- Homepage:
- Size: 254 KB
- Stars: 12
- Watchers: 1
- Forks: 2
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
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)