to-arraybuffer icon indicating copy to clipboard operation
to-arraybuffer copied to clipboard

Modernize

Open jimmywarting opened this issue 4 years ago • 0 comments

This will

  • update the devDep
  • it will not embed Buffer into the browser bundle (as they are always uint8array)
  • if argument is a arraybuffer, then just return it.
  • stop using Buffer constructor in test files
  • update the example in readme
  • and now it can also return the arraybuffer of any ArrayBuffer view (not just uint8array or buffer)

I would maybe have used new TextEncoder().encode(whatever).buffer as a fallback and not thrown on non typed arrays. Would also like to have switched this to ESM only package but decided to keep it as it's with as few changes

fixes #1 fixes #2 fixes #3

jimmywarting avatar Jul 09 '21 16:07 jimmywarting