* @author Feross Aboukhadijeh <feross@feross.org> <http://feross.org>
* @license MIT
*/
+/* eslint-disable no-proto */
var base64 = require('base64-js')
var ieee754 = require('ieee754')
return that
}
+if (Buffer.TYPED_ARRAY_SUPPORT) {
+ Buffer.prototype.__proto__ = Uint8Array.prototype
+ Buffer.__proto__ = Uint8Array
+}
+
function allocate (that, length) {
if (Buffer.TYPED_ARRAY_SUPPORT) {
// Return an augmented `Uint8Array` instance, for best performance
that = Buffer._augment(new Uint8Array(length))
+ that.__proto__ = Buffer.prototype
} else {
// Fallback: Return an object instance of the Buffer class
that.length = length
t.end()
})
+test('instanceof Buffer', function (t) {
+ var buf = new B([1, 2])
+ t.ok(buf instanceof B)
+ t.end()
+})
+
test('convert to Uint8Array in modern browsers', function (t) {
if (B.TYPED_ARRAY_SUPPORT) {
var buf = new B([1, 2])