To support buffers that come from other contexts like iframes, or Buffers that come from multiple version of buffer embedded in the same browserify bundle
Always use Buffer.isBuffer!!!
Object.defineProperty(Buffer.prototype, 'parent', {
get: function () {
- if (!(this instanceof Buffer)) {
+ if (!Buffer.isBuffer(this)) {
return undefined
}
return this.buffer
Object.defineProperty(Buffer.prototype, 'offset', {
get: function () {
- if (!(this instanceof Buffer)) {
+ if (!Buffer.isBuffer(this)) {
return undefined
}
return this.byteOffset