(that, length)
| 662 | } |
| 663 | |
| 664 | function createBuffer (that, length) { |
| 665 | if (kMaxLength() < length) { |
| 666 | throw new RangeError('Invalid typed array length') |
| 667 | } |
| 668 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 669 | // Return an augmented `Uint8Array` instance, for best performance |
| 670 | that = new Uint8Array(length) |
| 671 | that.__proto__ = Buffer.prototype |
| 672 | } else { |
| 673 | // Fallback: Return an object instance of the Buffer class |
| 674 | if (that === null) { |
| 675 | that = new Buffer(length) |
| 676 | } |
| 677 | that.length = length |
| 678 | } |
| 679 | |
| 680 | return that |
| 681 | } |
| 682 | |
| 683 | /** |
| 684 | * The Buffer constructor returns instances of `Uint8Array` that have their |
no test coverage detected