15 lines
399 B
JavaScript
15 lines
399 B
JavaScript
|
// Copyright (c) Microsoft Corporation. All rights reserved.
|
||
|
// Licensed under the MIT License.
|
||
|
|
||
|
class Guid {
|
||
|
static newGuid() {
|
||
|
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
|
||
|
var r = Math.random() * 16 | 0;
|
||
|
var v = c === 'x' ? r : (r & 0x3 | 0x8);
|
||
|
return v.toString(16);
|
||
|
});
|
||
|
}
|
||
|
}
|
||
|
|
||
|
module.exports.Guid = Guid;
|