Skip to content

Commit

Permalink
Merge pull request #148 from adventure-yunfei/master
Browse files Browse the repository at this point in the history
adventure-yunfei fix: wrong overwritting of not writable Unit8Array.from
  • Loading branch information
feross committed Dec 2, 2016
2 parents 0f45583 + 3639a98 commit 88941ed
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -84,9 +84,6 @@ function Buffer (arg, encodingOrOffset, length) {
return from(arg, encodingOrOffset, length)
}

Buffer.prototype.__proto__ = Uint8Array.prototype
Buffer.__proto__ = Uint8Array

// Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
if (typeof Symbol !== 'undefined' && Symbol.species &&
Buffer[Symbol.species] === Buffer) {
Expand Down Expand Up @@ -128,6 +125,10 @@ Buffer.from = function (value, encodingOrOffset, length) {
return from(value, encodingOrOffset, length)
}

Buffer.prototype.__proto__ = Uint8Array.prototype
// Assign Uint8Array as proto AFTER setting Buffer.from
Buffer.__proto__ = Uint8Array

function assertSize (size) {
if (typeof size !== 'number') {
throw new TypeError('"size" argument must be a number')
Expand Down

0 comments on commit 88941ed

Please sign in to comment.