var buf
if (Buffer._useTypedArrays) {
// Preferred: Return an augmented `Uint8Array` instance for best performance
- buf = augment(new Uint8Array(length))
+ buf = Buffer._augment(new Uint8Array(length))
} else {
// Fallback: Return THIS instance of Buffer (created by `new`)
buf = this
end = clamp(end, len, len)
if (Buffer._useTypedArrays) {
- return augment(this.subarray(start, end))
+ return Buffer._augment(this.subarray(start, end))
} else {
var sliceLen = end - start
var newBuf = new Buffer(sliceLen, undefined, true)
/**
* Augment the Uint8Array *instance* (not the class!) with Buffer methods
*/
-function augment (arr) {
+Buffer._augment = function (arr) {
arr._isBuffer = true
// save reference to original Uint8Array get/set methods before overwriting