I've recently been having quite a bit of trouble with the browser's built-in Map:
So I went hunting and found your project - it looks great! Is there any interest in making it browser-compatible by detecting if the code is running in a browser and switching out Buffer for ArrayBuffer? Or even just using feross's browser-based buffer polyfill? https://github.com/feross/buffer
For crypto.randomBytes, there's this isomorphic lib: https://www.npmjs.com/package/randombytes
Edit: Here's a working proof of concept: https://gist.github.com/josephrocca/019f091e5f83e410533caeb6f371200e
All I did was:
npm install buffer
npm install randombytes
Then, in index.js, swap require('crypto').randomBytes for require('randombytes'), and then just:
npm install -g browserify
browserify index.js -o HashTable.mjs
I haven't used browserify before so that linked script pulls HashTable and Buffer out of the module in a weird way... but it works! (see bottom of HashTable.mjs)
I've recently been having quite a bit of trouble with the browser's built-in Map:
So I went hunting and found your project - it looks great! Is there any interest in making it browser-compatible by detecting if the code is running in a browser and switching out Buffer for ArrayBuffer? Or even just using feross's browser-based buffer polyfill? https://github.com/feross/buffer
For
crypto.randomBytes, there's this isomorphic lib: https://www.npmjs.com/package/randombytesEdit: Here's a working proof of concept: https://gist.github.com/josephrocca/019f091e5f83e410533caeb6f371200e
All I did was:
Then, in
index.js, swaprequire('crypto').randomBytesforrequire('randombytes'), and then just:I haven't used browserify before so that linked script pulls HashTable and Buffer out of the module in a weird way... but it works! (see bottom of
HashTable.mjs)