0.1.0 • Published 7 years ago

node-unique-id-generator v0.1.0

Weekly downloads
38
License
ISC
Repository
github
Last release
7 years ago

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