Get UUID - Node.js Security

Node.js examples for Security:GUID

Description

Get UUID

Demo Code

Math.cuid = function(){
    var t = Math.floor((new Date()).getTime()/1000),
        r = (Math.random() * 100000000),
        lb = Math.floor(Math.random() * 15);
    /*from  w  w w .j  av  a  2 s  . c om*/
    r = (r << 4) | lb;
    return t.toString(16) + r.toString(16).padLeft(8, '0');
};

Related Tutorials