UNPKG

572 BJavaScriptView Raw
1/**
2 * Copyright (c) Facebook, Inc. and its affiliates.
3 *
4 * This source code is licensed under the MIT license found in the
5 * LICENSE file in the root directory of this source tree.
6 *
7 * @format
8 */
9
10/* eslint-disable no-bitwise */
11
12'use strict';
13
14/**
15 * Module that provides a function for creating a unique identifier.
16 * The returned value does not conform to the GUID standard, but should
17 * be globally unique in the context of the browser.
18 */
19function guid() {
20 return 'f' + (Math.random() * (1 << 30)).toString(16).replace('.', '');
21}
22
23module.exports = guid;