source: trip-planner-front/node_modules/uuid/dist/v4.js@ 6a80231

Last change on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 860 bytes
Line 
1"use strict";
2
3Object.defineProperty(exports, "__esModule", {
4 value: true
5});
6exports.default = void 0;
7
8var _rng = _interopRequireDefault(require("./rng.js"));
9
10var _stringify = _interopRequireDefault(require("./stringify.js"));
11
12function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
13
14function v4(options, buf, offset) {
15 options = options || {};
16
17 const rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
18
19
20 rnds[6] = rnds[6] & 0x0f | 0x40;
21 rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
22
23 if (buf) {
24 offset = offset || 0;
25
26 for (let i = 0; i < 16; ++i) {
27 buf[offset + i] = rnds[i];
28 }
29
30 return buf;
31 }
32
33 return (0, _stringify.default)(rnds);
34}
35
36var _default = v4;
37exports.default = _default;
Note: See TracBrowser for help on using the repository browser.