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

bytesToUuid.js 903B

123456789101112131415161718192021222324252627
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. /**
  7. * Convert array of 16 byte values to UUID string format of the form:
  8. * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
  9. */
  10. var byteToHex = [];
  11. for (var i = 0; i < 256; ++i) {
  12. byteToHex[i] = (i + 0x100).toString(16).substr(1);
  13. }
  14. function bytesToUuid(buf, offset) {
  15. var i = offset || 0;
  16. var bth = byteToHex; // join used to fix memory issue caused by concatenation: https://bugs.chromium.org/p/v8/issues/detail?id=3175#c4
  17. return [bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], '-', bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]], bth[buf[i++]]].join('');
  18. }
  19. var _default = bytesToUuid;
  20. exports.default = _default;
  21. module.exports = exports.default;