From ae34dcfd3823a609ba7182f2d6eda593be876f7d Mon Sep 17 00:00:00 2001 From: Arman Shah Date: Mon, 19 Feb 2018 23:50:04 -0800 Subject: add base files --- node_modules/uuid/lib/bytesToUuid.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 node_modules/uuid/lib/bytesToUuid.js (limited to 'node_modules/uuid/lib/bytesToUuid.js') diff --git a/node_modules/uuid/lib/bytesToUuid.js b/node_modules/uuid/lib/bytesToUuid.js new file mode 100644 index 0000000..2c9a223 --- /dev/null +++ b/node_modules/uuid/lib/bytesToUuid.js @@ -0,0 +1,23 @@ +/** + * Convert array of 16 byte values to UUID string format of the form: + * XXXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXXXX + */ +var byteToHex = []; +for (var i = 0; i < 256; ++i) { + byteToHex[i] = (i + 0x100).toString(16).substr(1); +} + +function bytesToUuid(buf, offset) { + var i = offset || 0; + var bth = byteToHex; + 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++]]; +} + +module.exports = bytesToUuid; -- cgit v1.2.3