Thagichu.

T.

Unique ID generators for Javascript

Unique ID generators for Javascript

Published at Jun 6, 2022

Writen by Thagichu Anthony

Intro

Javascript has multiple libraries that help in generating unique IDs, some of the more common ones are:

UUID

https://www.npmjs.com/package/uuid

npm install --save uuid
import { v4 as uuidv4 } from 'uuid';

uuidv4(); // "9b1deb4d-3b7d-4bad-9bdd-2b0d7b3dcb6d"

NANOID

https://www.npmjs.com/package/nanoid

npm install --save nanoid
import { nanoid } from 'nanoid'

nanoid() // "V1StGXR8_Z5jdHi6B-myT"

CUID

https://www.npmjs.com/package/cuid

npm install --save cuid
import cuid from 'cuid';

cuid(); // cjld2cjxh0000qzrmn831i7rn

SHORTID

https://www.npmjs.com/package/shortid

npm install --save shortid
import shortid from 'shortid';

shortid.generate(); // PPBqWA9
Designed & Developed by Dev Thagichu
© 2018-2024 Blogfolio.All Rights Reserved.