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.
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
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.