Allow caller to supply custom prefix to genUuid

This commit is contained in:
Tony Garnock-Jones 2018-11-05 21:16:31 +00:00
parent f7dec50a70
commit d256163d59
1 changed files with 3 additions and 3 deletions

View File

@ -50,7 +50,7 @@ module.exports.bootModule = Ground.bootModule;
// These aren't so much "Universal" as they are "VM-wide-unique".
let uuidIndex = 0;
let uuidPrefix = '__@syndicate__' + RandomID.randomId(8) + '_';
module.exports.genUuid = function () {
return uuidPrefix + uuidIndex++;
let uuidPrefix = '__@syndicate__' + RandomID.randomId(8);
module.exports.genUuid = function (prefix) {
return (prefix || uuidPrefix) + '_' + uuidIndex++;
};