UNPKG

jquery-crate

Version:

Cratify tool that turns a division into a distributed and decentralized collaborative editor

21 lines (18 loc) 544 B
/* * \url https://github.com/justayak/yutils/blob/master/yutils.js * \author justayak */ /*! * \brief get a globally unique (with high probability) identifier * \return a string being the identifier */ function GUID(){ var d = new Date().getTime(); var guid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { var r = (d + Math.random() * 16) % 16 | 0; d = Math.floor(d / 16); return (c === 'x' ? r : (r & 0x3 | 0x8)).toString(16); }); return guid; }; module.exports = GUID;