summaryrefslogtreecommitdiff
path: root/together/node_modules/hexoid/dist/index.js
diff options
context:
space:
mode:
Diffstat (limited to 'together/node_modules/hexoid/dist/index.js')
-rw-r--r--together/node_modules/hexoid/dist/index.js15
1 files changed, 15 insertions, 0 deletions
diff --git a/together/node_modules/hexoid/dist/index.js b/together/node_modules/hexoid/dist/index.js
new file mode 100644
index 0000000..a867b57
--- /dev/null
+++ b/together/node_modules/hexoid/dist/index.js
@@ -0,0 +1,15 @@
+var IDX=256, HEX=[];
+while (IDX--) HEX[IDX] = (IDX + 256).toString(16).substring(1);
+
+module.exports = function (len) {
+ len = len || 16;
+ var str='', num=0;
+ return function () {
+ if (!str || num === 256) {
+ str=''; num=(1+len)/2 | 0;
+ while (num--) str += HEX[256 * Math.random() | 0];
+ str = str.substring(num=0, len-2);
+ }
+ return str + HEX[num++];
+ };
+}