aboutsummaryrefslogtreecommitdiffstats
path: root/backend/node_modules/uuid/dist/esm-node/v35.js
diff options
context:
space:
mode:
authorLeonardo Bishop <me@leonardobishop.com>2023-11-04 21:28:11 +0000
committerLeonardo Bishop <me@leonardobishop.com>2023-11-04 21:28:11 +0000
commit7d8cca54e548d2a85287fd2325db88f2697be55a (patch)
tree3daa82c6a709363f2f08d9f875d849e4babe1f8f /backend/node_modules/uuid/dist/esm-node/v35.js
parente1633f3348ff7fc5e9131eeae2f2feba09f04838 (diff)
Add more shit
Diffstat (limited to 'backend/node_modules/uuid/dist/esm-node/v35.js')
-rw-r--r--backend/node_modules/uuid/dist/esm-node/v35.js66
1 files changed, 66 insertions, 0 deletions
diff --git a/backend/node_modules/uuid/dist/esm-node/v35.js b/backend/node_modules/uuid/dist/esm-node/v35.js
new file mode 100644
index 0000000..3355e1f
--- /dev/null
+++ b/backend/node_modules/uuid/dist/esm-node/v35.js
@@ -0,0 +1,66 @@
+import { unsafeStringify } from './stringify.js';
+import parse from './parse.js';
+
+function stringToBytes(str) {
+ str = unescape(encodeURIComponent(str)); // UTF8 escape
+
+ const bytes = [];
+
+ for (let i = 0; i < str.length; ++i) {
+ bytes.push(str.charCodeAt(i));
+ }
+
+ return bytes;
+}
+
+export const DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';
+export const URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';
+export default function v35(name, version, hashfunc) {
+ function generateUUID(value, namespace, buf, offset) {
+ var _namespace;
+
+ if (typeof value === 'string') {
+ value = stringToBytes(value);
+ }
+
+ if (typeof namespace === 'string') {
+ namespace = parse(namespace);
+ }
+
+ if (((_namespace = namespace) === null || _namespace === void 0 ? void 0 : _namespace.length) !== 16) {
+ throw TypeError('Namespace must be array-like (16 iterable integer values, 0-255)');
+ } // Compute hash of namespace and value, Per 4.3
+ // Future: Use spread syntax when supported on all platforms, e.g. `bytes =
+ // hashfunc([...namespace, ... value])`
+
+
+ let bytes = new Uint8Array(16 + value.length);
+ bytes.set(namespace);
+ bytes.set(value, namespace.length);
+ bytes = hashfunc(bytes);
+ bytes[6] = bytes[6] & 0x0f | version;
+ bytes[8] = bytes[8] & 0x3f | 0x80;
+
+ if (buf) {
+ offset = offset || 0;
+
+ for (let i = 0; i < 16; ++i) {
+ buf[offset + i] = bytes[i];
+ }
+
+ return buf;
+ }
+
+ return unsafeStringify(bytes);
+ } // Function#name is not settable on some platforms (#270)
+
+
+ try {
+ generateUUID.name = name; // eslint-disable-next-line no-empty
+ } catch (err) {} // For CommonJS default export support
+
+
+ generateUUID.DNS = DNS;
+ generateUUID.URL = URL;
+ return generateUUID;
+} \ No newline at end of file