(that, length)
| 358 | } |
| 359 | |
| 360 | function createBuffer (that, length) { |
| 361 | if (kMaxLength() < length) { |
| 362 | throw new RangeError('Invalid typed array length') |
| 363 | } |
| 364 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 365 | // Return an augmented `Uint8Array` instance, for best performance |
| 366 | that = new Uint8Array(length) |
| 367 | that.__proto__ = Buffer.prototype |
| 368 | } else { |
| 369 | // Fallback: Return an object instance of the Buffer class |
| 370 | if (that === null) { |
| 371 | that = new Buffer(length) |
| 372 | } |
| 373 | that.length = length |
| 374 | } |
| 375 | |
| 376 | return that |
| 377 | } |
| 378 | |
| 379 | /** |
| 380 | * The Buffer constructor returns instances of `Uint8Array` that have their |
no test coverage detected