Closed dignifiedquire closed 8 years ago
Right you are. Sorry about that.
Actually, what version of browserify are you using? The latest version of buffer (used in browserify 13) doesn't require setting ._isBuffer
manually on each instance since it's inherited through the prototype chain. See: https://github.com/feross/buffer/blob/master/index.js#L418
Arrrrggh -.- you are right the buffer version was outdated in one dependency (I'm using webpack for this one) updating it makes the issue go away.. Thanks.
Hoping that by inheriting the whole prototype (i.e. Buffer is now a proper ES6 subclass of Uint8Array) we won't have version incompatibilities like this going forward. Sorry that this bit you though :(
Actually, there's an even better solution. We can just stop depending on the internals of the browser buffer implementation since new Buffer(arrayBuffer)
doesn't do a copy. See PR https://github.com/feross/typedarray-to-buffer/pull/6
Given the following:
The reason for this is that the
isBuffer
check checks for._isBuffer
on the element but the code path on here https://github.com/feross/typedarray-to-buffer/blob/master/index.js#L17-L19 does not add that property.