Software zum Installieren eines Smart-Mirror Frameworks , zum Nutzen von hochschulrelevanten Informationen, auf einem Raspberry-Pi.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

parse.js 1.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. "use strict";
  2. Object.defineProperty(exports, "__esModule", {
  3. value: true
  4. });
  5. exports.default = void 0;
  6. var _validate = _interopRequireDefault(require("./validate.js"));
  7. function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
  8. function parse(uuid) {
  9. if (!(0, _validate.default)(uuid)) {
  10. throw TypeError('Invalid UUID');
  11. }
  12. let v;
  13. const arr = new Uint8Array(16); // Parse ########-....-....-....-............
  14. arr[0] = (v = parseInt(uuid.slice(0, 8), 16)) >>> 24;
  15. arr[1] = v >>> 16 & 0xff;
  16. arr[2] = v >>> 8 & 0xff;
  17. arr[3] = v & 0xff; // Parse ........-####-....-....-............
  18. arr[4] = (v = parseInt(uuid.slice(9, 13), 16)) >>> 8;
  19. arr[5] = v & 0xff; // Parse ........-....-####-....-............
  20. arr[6] = (v = parseInt(uuid.slice(14, 18), 16)) >>> 8;
  21. arr[7] = v & 0xff; // Parse ........-....-....-####-............
  22. arr[8] = (v = parseInt(uuid.slice(19, 23), 16)) >>> 8;
  23. arr[9] = v & 0xff; // Parse ........-....-....-....-############
  24. // (Use "/" to avoid 32-bit truncation when bit-shifting high-order bytes)
  25. arr[10] = (v = parseInt(uuid.slice(24, 36), 16)) / 0x10000000000 & 0xff;
  26. arr[11] = v / 0x100000000 & 0xff;
  27. arr[12] = v >>> 24 & 0xff;
  28. arr[13] = v >>> 16 & 0xff;
  29. arr[14] = v >>> 8 & 0xff;
  30. arr[15] = v & 0xff;
  31. return arr;
  32. }
  33. var _default = parse;
  34. exports.default = _default;