(that, length)
| 1937 | } |
| 1938 | |
| 1939 | function createBuffer (that, length) { |
| 1940 | if (kMaxLength() < length) { |
| 1941 | throw new RangeError('Invalid typed array length') |
| 1942 | } |
| 1943 | if (Buffer.TYPED_ARRAY_SUPPORT) { |
| 1944 | // Return an augmented `Uint8Array` instance, for best performance |
| 1945 | that = new Uint8Array(length); |
| 1946 | that.__proto__ = Buffer.prototype; |
| 1947 | } else { |
| 1948 | // Fallback: Return an object instance of the Buffer class |
| 1949 | if (that === null) { |
| 1950 | that = new Buffer(length); |
| 1951 | } |
| 1952 | that.length = length; |
| 1953 | } |
| 1954 | |
| 1955 | return that |
| 1956 | } |
| 1957 | |
| 1958 | /** |
| 1959 | * The Buffer constructor returns instances of `Uint8Array` that have their |
no test coverage detected