source: imaps-frontend/node_modules/uuid/dist/esm-browser/v4.js@ 79a0317

main
Last change on this file since 79a0317 was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 3 days ago

F4 Finalna Verzija

  • Property mode set to 100644
File size: 619 bytes
Line 
1import native from './native.js';
2import rng from './rng.js';
3import { unsafeStringify } from './stringify.js';
4function v4(options, buf, offset) {
5 if (native.randomUUID && !buf && !options) {
6 return native.randomUUID();
7 }
8 options = options || {};
9 const rnds = options.random || (options.rng || rng)();
10 rnds[6] = (rnds[6] & 0x0f) | 0x40;
11 rnds[8] = (rnds[8] & 0x3f) | 0x80;
12 if (buf) {
13 offset = offset || 0;
14 for (let i = 0; i < 16; ++i) {
15 buf[offset + i] = rnds[i];
16 }
17 return buf;
18 }
19 return unsafeStringify(rnds);
20}
21export default v4;
Note: See TracBrowser for help on using the repository browser.