buf[i] not working sometimes
Causing zlib-browserify to be broken: https://github.com/brianloveswords/zlib-browserify/issues/6
To produce the issue:
- Clone this gist
browserify test.js >out.js- Copy out.js into jsbeautifier.org and then paste back into out.js
- Add a
debuggerstatement like this:
debugger
a.C = l[k++];
a.D = l[k++];
(31 !== a.C || 139 !== a.D) && m(Error("invalid file signature:", a.C, a.D));
- run in the browser
You will notice that l is a Buffer and l[0] is yielding undefined when it should yield 31. Note also that l.parent[0] works.
@substack might be interested to see this.
I've found that an implementation of a streaming Boyer-Moore-Horspool search streamsearch breaks because of this. Seems pretty egregious as it's a break from the Node API.
@terinjokes for what it's worth, I think I got around the issue by using https://github.com/chrisdickinson/bops
but even then there was an issue I had to work around: https://github.com/chrisdickinson/bops/pull/7
This actually looks fixed in HEAD, but hasn't been pulled into a newer version of insert-module-globals.