1 | ;
|
2 |
|
3 | /**
|
4 | * Copyright 2004-present Facebook. All Rights Reserved.
|
5 | *
|
6 | * @typechecks
|
7 | *
|
8 | * @format
|
9 | */
|
10 |
|
11 | /*eslint-disable no-bitwise */
|
12 |
|
13 | /**
|
14 | * Based on the rfc4122-compliant solution posted at
|
15 | * http://stackoverflow.com/questions/105034
|
16 | */
|
17 | function uuid() {
|
18 | return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) {
|
19 | var r = Math.random() * 16 | 0;
|
20 | var v = c == 'x' ? r : r & 0x3 | 0x8;
|
21 | return v.toString(16);
|
22 | });
|
23 | }
|
24 |
|
25 | module.exports = uuid; |
\ | No newline at end of file |