Simple and lightweight UUID generator with parser in 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:

Simple and fast unique GUID generator in JavaScript

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}

The post Simple and lightweight UUID generator with parser in JavaScript appeared first on Lipku.com.

Leave a Reply

Your email address will not be published. Required fields are marked *