Simple and lightweight UUID generator with parser in JavaScript

Category: JavaScript/jQuery Plugins Recommended | October 21, 2021
Author: ryouaki
Official Page: Go to website
Last Update: October 21, 2021
License: MIT

uuid generator javascript

About:

A simple and lightweight UUID (Universally Unique Identifiers) generator with parser in JavaScript, which is also compatible with node.js. Which means, same library can be used for browser and node.js too.

Basic features:

  • Can generate up to 262143 different ids in one second;
  • Can keep sequence
  • Generated id‘s length is 15. less than others.
  • Can be de-serialized
  • With zero dependencies
  • Size less than 1kb

You may also like:

How to install and use it?

1. Install the UUID generator with NPM.

npm install lsp-uuid -save

2. Then, import the component.

import { uuid, parseUUID } from 'lsp-uuid'

3. Now, generate the UUID with this function.

const id = uuid();

// 5f095641fe00000

4. If you want to parse the UUID, you can do it like this:

parseUUID(id) 

will result like this
// {flg: 0, timestamp: 1632714164216, count: 0}