2017-02-20 12:24:46 -06:00
|
|
|
'use strict';
|
|
|
|
|
|
|
|
const isDevEnv = process.env.ELECTRON_DEV ?
|
2017-03-03 18:07:48 -06:00
|
|
|
process.env.ELECTRON_DEV.trim().toLowerCase() === 'true' : false;
|
2017-02-20 12:24:46 -06:00
|
|
|
|
|
|
|
const isMac = (process.platform === 'darwin');
|
|
|
|
|
|
|
|
/**
|
|
|
|
* 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-03-03 18:07:48 -06:00
|
|
|
const guid = 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g,
|
2017-02-26 19:58:48 -06:00
|
|
|
function(c) {
|
2017-03-03 18:07:48 -06:00
|
|
|
var 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-26 19:58:48 -06:00
|
|
|
return guid;
|
2017-02-20 12:24:46 -06:00
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
isDevEnv: isDevEnv,
|
|
|
|
isMac: isMac,
|
|
|
|
getGuid: getGuid
|
|
|
|
};
|