to-arraybuffer
to-arraybuffer copied to clipboard
Modernize
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