Skip to content

AyushG3112/node-unique-id-generator

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

node-unique-id-generator

A npm module to generate Unique ID and GUID for node.

Table of Contents

Installation

npm install node-unique-id-generator --save

How to use

Generate Unique ID

Unique ID with no prefix or suffix

const uidGenerator = require('node-unique-id-generator');
console.log(uidGenerator.generateUniqueId()); // 149897061806898563200922e1443e123

Unique ID with prefix

const uidGenerator = require('node-unique-id-generator');
console.log(uidGenerator.generateUniqueId('pre-')); // pre-149897061806898563200922e1443e123

Unique ID with prefix and suffix

const uidGenerator = require('node-unique-id-generator');
console.log(uidGenerator.generateUniqueId('pre-','-suf')); // pre-149897061806898563200922e1443e123-suf

Unique ID with suffix

const uidGenerator = require('node-unique-id-generator');
console.log(uidGenerator.generateUniqueId('','-suf')); // 149897061806898563200922e1443e123-suf

Generate GUID

const uidGenerator = require('node-unique-id-generator');
console.log(uidGenerator.generateGUID()); // 5ccf7d01-3553-3e2b-a96e-1200cda69640

About

A npm module to generate Unique Id and GUID for node.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published