Closed martinheidegger closed 3 years ago
That package still depends on a Buffer
polyfill to be available from what I gather. Wouldn't it maybe be better to use ArrayBuffer instead, which is always available in all environments?
@silverwind thank you for the attention. I assume with "that package" you mean @leichtgewicht/ip-codec? It uses Buffer only in the test not in general code.
Ah, I misread your code. I see it's using Uint8Array
in the code which indeed is browser-compatible, so this should be fine.
Awesome @martinheidegger - Is your package using the same regexes etc as the previous one?
Yes. Same Regexes, same algorithm. Same Tests. A bit of cleanup here and there. Full coverage: https://github.com/martinheidegger/ip-codec/runs/2960741507?check_suite_focus=true#step:5:64
The
ip
npm package references bothbuffer
andos
which makes it kind of stressful to use in a browser setting. This PR uses the extracted encoding functionality ofnode-ip
through @leichtgewicht/ip-codec. Reducing a bit of performance overhead in the process.