repoweaver
Version:
A GitHub App that skillfully weaves multiple templates together to create and update repositories with intelligent merge strategies
1 lines • 5.64 kB
JSON
{"ast":null,"code":"import bytesToUuid from \"./bytesToUuid\";\nfunction uuidToBytes(uuid) {\n const bytes = [];\n uuid.replace(/[a-fA-F0-9]{2}/g, hex => {\n bytes.push(parseInt(hex, 16));\n return '';\n });\n return bytes;\n}\nfunction stringToBytes(str) {\n str = unescape(encodeURIComponent(str));\n const bytes = new Array(str.length);\n for (let i = 0; i < str.length; i++) {\n bytes[i] = str.charCodeAt(i);\n }\n return bytes;\n}\nexport default function (name, version, hashfunc) {\n const generateUUID = function (value, namespace, buf, offset) {\n const off = buf && offset || 0;\n if (typeof value == 'string') value = stringToBytes(value);\n if (typeof namespace == 'string') namespace = uuidToBytes(namespace);\n if (!Array.isArray(value)) throw TypeError('value must be an array of bytes');\n if (!Array.isArray(namespace) || namespace.length !== 16) throw TypeError('namespace must be uuid string or an Array of 16 byte values');\n const bytes = hashfunc(namespace.concat(value));\n bytes[6] = bytes[6] & 0x0f | version;\n bytes[8] = bytes[8] & 0x3f | 0x80;\n if (buf) {\n for (let idx = 0; idx < 16; ++idx) {\n buf[off + idx] = bytes[idx];\n }\n }\n return bytesToUuid(bytes);\n };\n try {\n generateUUID.name = name;\n } catch {}\n generateUUID.DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\n generateUUID.URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\n return generateUUID;\n}","map":{"version":3,"names":["bytesToUuid","uuidToBytes","uuid","bytes","replace","hex","push","parseInt","stringToBytes","str","unescape","encodeURIComponent","Array","length","i","charCodeAt","name","version","hashfunc","generateUUID","value","namespace","buf","offset","off","isArray","TypeError","concat","idx","DNS","URL"],"sources":["/Users/pmouli/Documents/GitHub.nosync/boots-strapper/mobile/node_modules/expo-modules-core/src/uuid/lib/v35.ts"],"sourcesContent":["import bytesToUuid from './bytesToUuid';\n\nfunction uuidToBytes(uuid: string) {\n // Note: We assume we're being passed a valid uuid string\n const bytes: number[] = [];\n uuid.replace(/[a-fA-F0-9]{2}/g, (hex: string) => {\n bytes.push(parseInt(hex, 16));\n return '';\n });\n\n return bytes;\n}\n\nfunction stringToBytes(str: string) {\n str = unescape(encodeURIComponent(str)); // UTF8 escape\n const bytes: number[] = new Array(str.length);\n for (let i = 0; i < str.length; i++) {\n bytes[i] = str.charCodeAt(i);\n }\n return bytes;\n}\n\nexport default function (\n name: string,\n version: number,\n hashfunc: (bytes: number[] | string) => number[]\n) {\n const generateUUID = function (\n value: number[] | string,\n namespace: number[] | string,\n buf?: number[],\n offset?: number\n ): string {\n const off = (buf && offset) || 0;\n\n if (typeof value == 'string') value = stringToBytes(value);\n if (typeof namespace == 'string') namespace = uuidToBytes(namespace);\n\n if (!Array.isArray(value)) throw TypeError('value must be an array of bytes');\n if (!Array.isArray(namespace) || namespace.length !== 16)\n throw TypeError('namespace must be uuid string or an Array of 16 byte values');\n\n // Per 4.3\n const bytes = hashfunc(namespace.concat(value));\n bytes[6] = (bytes[6] & 0x0f) | version;\n bytes[8] = (bytes[8] & 0x3f) | 0x80;\n\n if (buf) {\n for (let idx = 0; idx < 16; ++idx) {\n buf[off + idx] = bytes[idx];\n }\n }\n\n return bytesToUuid(bytes);\n };\n\n // Function#name is not settable on some platforms (#270)\n try {\n generateUUID.name = name;\n } catch {}\n\n // Pre-defined namespaces, per Appendix C\n generateUUID.DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8';\n generateUUID.URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8';\n\n return generateUUID;\n}\n"],"mappings":"AAAA,OAAOA,WAAW;AAElB,SAASC,WAAWA,CAACC,IAAY,EAAE;EAEjC,MAAMC,KAAe,GAAG,EAAE;EAC1BD,IAAI,CAACE,OAAO,CAAC,iBAAiB,EAAGC,GAAW,IAAK;IAC/CF,KAAK,CAACG,IAAI,CAACC,QAAQ,CAACF,GAAG,EAAE,EAAE,CAAC,CAAC;IAC7B,OAAO,EAAE;EACX,C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