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());
Unique ID with prefix
const uidGenerator = require('node-unique-id-generator');
console.log(uidGenerator.generateUniqueId('pre-'));
Unique ID with prefix and suffix
const uidGenerator = require('node-unique-id-generator');
console.log(uidGenerator.generateUniqueId('pre-','-suf'));
Unique ID with suffix
const uidGenerator = require('node-unique-id-generator');
console.log(uidGenerator.generateUniqueId('','-suf'));
Generate GUID
const uidGenerator = require('node-unique-id-generator');
console.log(uidGenerator.generateGUID());