Generate a unique random ID string. GUI demo can be found here.
Using npm:
npm i generate-unique-id
Using yarn:
yarn add generate-unique-id
Using classic "src"
<script src="path/to/the/file/generateUniqueId.js"></script>
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']
});
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. |