From: Feross Aboukhadijeh Date: Tue, 8 Apr 2014 06:36:14 +0000 (-0700) Subject: expose augment as Buffer._augment X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=03b37c090911c60875e97e0c63ab2175aa668e2d;p=buffer.git expose augment as Buffer._augment --- diff --git a/index.js b/index.js index 911507b..6ddb57c 100644 --- a/index.js +++ b/index.js @@ -81,7 +81,7 @@ function Buffer (subject, encoding, noZero) { 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 @@ -465,7 +465,7 @@ Buffer.prototype.slice = function (start, end) { 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) @@ -935,7 +935,7 @@ var BP = Buffer.prototype /** * 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