Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

v4.js 1008B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _rng = _interopRequireDefault(require("./rng.js"));
  7. var _bytesToUuid = _interopRequireDefault(require("./bytesToUuid.js"));
  8. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  9. function v4(options, buf, offset) {
  10. var i = buf && offset || 0;
  11. if (typeof options == 'string') {
  12. buf = options === 'binary' ? new Array(16) : null;
  13. options = null;
  14. }
  15. options = options || {};
  16. var rnds = options.random || (options.rng || _rng.default)(); // Per 4.4, set bits for version and `clock_seq_hi_and_reserved`
  17. rnds[6] = rnds[6] & 0x0f | 0x40;
  18. rnds[8] = rnds[8] & 0x3f | 0x80; // Copy bytes to buffer, if provided
  19. if (buf) {
  20. for (var ii = 0; ii < 16; ++ii) {
  21. buf[i + ii] = rnds[ii];
  22. }
  23. }
  24. return buf || (0, _bytesToUuid.default)(rnds);
  25. }
  26. var _default = v4;
  27. exports.default = _default;
  28. module.exports = exports.default;