@@ -113,6 +113,18 @@ function Buffer (arg, encodingOrOffset, length) {
113
113
return from ( this , arg , encodingOrOffset , length )
114
114
}
115
115
116
+ if ( Buffer . TYPED_ARRAY_SUPPORT ) {
117
+ Buffer . prototype . __proto__ = Uint8Array . prototype
118
+ Buffer . __proto__ = Uint8Array
119
+ if ( typeof Symbol !== 'undefined' && Symbol . species &&
120
+ Buffer [ Symbol . species ] === Buffer ) {
121
+ // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
122
+ Object . defineProperty ( Buffer , Symbol . species , {
123
+ value : null ,
124
+ configurable : true
125
+ } )
126
+ }
127
+ }
116
128
Buffer . poolSize = 8192 // not used by this implementation
117
129
118
130
// TODO: Legacy, not needed anymore. Remove in next major version.
@@ -149,19 +161,6 @@ Buffer.from = function (value, encodingOrOffset, length) {
149
161
return from ( null , value , encodingOrOffset , length )
150
162
}
151
163
152
- if ( Buffer . TYPED_ARRAY_SUPPORT ) {
153
- Buffer . prototype . __proto__ = Uint8Array . prototype
154
- Buffer . __proto__ = Uint8Array
155
- if ( typeof Symbol !== 'undefined' && Symbol . species &&
156
- Buffer [ Symbol . species ] === Buffer ) {
157
- // Fix subarray() in ES2016. See: https://github.com/feross/buffer/pull/97
158
- Object . defineProperty ( Buffer , Symbol . species , {
159
- value : null ,
160
- configurable : true
161
- } )
162
- }
163
- }
164
-
165
164
function assertSize ( size ) {
166
165
if ( typeof size !== 'number' ) {
167
166
throw new TypeError ( '"size" argument must be a number' )
0 commit comments