Skip to content

Instantly share code, notes, and snippets.

@katlogic
Created May 16, 2014 19:50
Show Gist options
  • Save katlogic/85c767797603cdba3111 to your computer and use it in GitHub Desktop.
Save katlogic/85c767797603cdba3111 to your computer and use it in GitHub Desktop.
'use strict'
let Buffer = function(a,b)
{
if (!(this instanceof Buffer))
return new Buffer(a, b)
let self = Uint8Array.call(this,a,b)
self.__proto__ = Buffer.prototype
return self
}
Buffer.prototype = Object.create(Uint8Array.prototype, Buffer.prototype)
Buffer.prototype.x = 1
let x = new Buffer(12)
console.log(x instanceof Buffer)
console.log(x instanceof Uint8Array)
console.log(x.slice)
console.log(x.x)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment