2017-02-20 12:24:46 -06:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
/**
|
|
|
|
* Generates a guid,
|
|
|
|
* http://stackoverflow.com/questions/105034/create-guid-uuid-in-javascript
|
2017-02-26 19:58:48 -06:00
|
|
|
*
|
2017-02-20 12:24:46 -06:00
|
|
|
* @return {String} guid value in string
|
|
|
|
*/
|
|
|
|
function getGuid() {
|
2017-08-24 02:51:02 -05:00
|
|
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,
|
|
|
|
function (c) {
|
|
|
|
let r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
|
2017-02-26 19:58:48 -06:00
|
|
|
return v.toString(16);
|
2017-03-03 18:07:48 -06:00
|
|
|
});
|
2017-02-20 12:24:46 -06:00
|
|
|
}
|
|
|
|
|
2017-03-09 12:12:28 -06:00
|
|
|
module.exports = getGuid;
|