Generate unique random id with urid
Generate unique/random id based on the given size and character set. Default id size is 16 characters and it is randomly generated from [0-9a-bA-B] characters.
Install
npm install urid
Usage
import urid from urid
const id = urid();
urid() function
Call the function urid()
with two optional parameter values (size
, charset
) to get desired result.
const size = 20;
const charset = 'ALPHANUM';
urid(size, charset);
Examples
const id = urid();
urid(8);
urid('num');
urid('alpha');
urid('alphanum');
urid(12, 'alpha');
urid(6, '0123456789ABCDEF');
urid('0123456789ABCDEF');
urid()
urid(24)
urid(8, 'num')
urid(8, 'alpha')
urid(8, 'alphanum')
urid('num')
urid('alpha')
urid('alphanum')
urid('Alpha')
urid('ALPHA')
urid('ALPHANUM')
urid('hex')
urid('HEX')
urid('ABCD-')
LICENSE
MIT
Author
Created by Jiten Bansal