PHP 7.4.33
Preview: stringify.js Size: 1.74 KB
/var/www/idmc.bitkit.dk/httpdocs/node_modules/uuid/dist/stringify.js
"use strict";

Object.defineProperty(exports, "__esModule", {
  value: true
});
exports.default = void 0;
exports.unsafeStringify = unsafeStringify;

var _validate = _interopRequireDefault(require("./validate.js"));

function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }

/**
 * Convert array of 16 byte values to UUID string format of the form:
 * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX
 */
const byteToHex = [];

for (let i = 0; i < 256; ++i) {
  byteToHex.push((i + 0x100).toString(16).slice(1));
}

function unsafeStringify(arr, offset = 0) {
  // Note: Be careful editing this code!  It's been tuned for performance
  // and works in ways you may not expect. See https://github.com/uuidjs/uuid/pull/434
  return byteToHex[arr[offset + 0]] + byteToHex[arr[offset + 1]] + byteToHex[arr[offset + 2]] + byteToHex[arr[offset + 3]] + '-' + byteToHex[arr[offset + 4]] + byteToHex[arr[offset + 5]] + '-' + byteToHex[arr[offset + 6]] + byteToHex[arr[offset + 7]] + '-' + byteToHex[arr[offset + 8]] + byteToHex[arr[offset + 9]] + '-' + byteToHex[arr[offset + 10]] + byteToHex[arr[offset + 11]] + byteToHex[arr[offset + 12]] + byteToHex[arr[offset + 13]] + byteToHex[arr[offset + 14]] + byteToHex[arr[offset + 15]];
}

function stringify(arr, offset = 0) {
  const uuid = unsafeStringify(arr, offset); // Consistency check for valid UUID.  If this throws, it's likely due to one
  // of the following:
  // - One or more input array values don't map to a hex octet (leading to
  // "undefined" in the uuid)
  // - Invalid input values for the RFC `version` or `variant` fields

  if (!(0, _validate.default)(uuid)) {
    throw TypeError('Stringified UUID is invalid');
  }

  return uuid;
}

var _default = stringify;
exports.default = _default;

Directory Contents

Dirs: 4 × Files: 21
Name Size Perms Modified Actions
bin DIR
- drwxrwxr-x 2024-09-23 09:37:21
Edit Download
- drwxrwxr-x 2024-09-23 09:37:22
Edit Download
- drwxrwxr-x 2024-09-23 09:37:22
Edit Download
esm-node DIR
- drwxrwxr-x 2024-09-23 09:37:22
Edit Download
1.72 KB lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
6.85 KB lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
550 B lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
271 B lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
350 B lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
188 B lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
1.35 KB lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
267 B lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
927 B lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
549 B lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
2.55 KB lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
553 B lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
1.74 KB lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
1.98 KB lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
3.52 KB lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
414 B lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
1009 B lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
417 B lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
2.03 KB lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
410 B lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
474 B lrw-rw-r-- 2024-09-23 09:37:22
Edit Download
If ZipArchive is unavailable, a .tar will be created (no compression).