1

I am using Node as backend and I was looking for a class that could generate Guid for me. I came across https://www.npmjs.com/package/guid

I installed it as npm install guid.

However, I am not sure how to import it in my class before I can actually use it.

user1892775
  • 2,001
  • 6
  • 37
  • 58
  • Maybe [this answer](https://stackoverflow.com/questions/38224232/how-to-consume-npm-modules-from-typescript/38225401#38225401) can help you. – Blackus Oct 17 '17 at 16:04

1 Answers1

1

You can use Guid like this:

npm install guid

Require it where u want to use

Guid = require('guid');

for creating a new Guid

guid = Guid.create(); //will give u guid object

guid.value; 
// will give u -> '7bf5b258-2f03-ad87-eca7-c868819d4c34'

you can check guid using equals method

guid.equals('7bf5b258-2f03-ad87-eca7-c868819d4c34') 
// -> true
kgangadhar
  • 4,886
  • 5
  • 36
  • 54