From d873301e16b4ab5e62365069d4d95c8795b2cbec Mon Sep 17 00:00:00 2001 From: Feross Aboukhadijeh Date: Wed, 7 May 2014 15:20:56 -0700 Subject: [PATCH] Buffer#fill should be chainable --- index.js | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/index.js b/index.js index c108847..2eafb89 100644 --- a/index.js +++ b/index.js @@ -911,6 +911,8 @@ Buffer.prototype.fill = function (value, start, end) { for (var i = start; i < end; i++) { this[i] = value } + + return this } Buffer.prototype.inspect = function () { @@ -948,11 +950,6 @@ Buffer.prototype.toArrayBuffer = function () { // HELPER FUNCTIONS // ================ -function stringtrim (str) { - if (str.trim) return str.trim() - return str.replace(/^\s+|\s+$/g, '') -} - var BP = Buffer.prototype /** @@ -1012,6 +1009,11 @@ Buffer._augment = function (arr) { return arr } +function stringtrim (str) { + if (str.trim) return str.trim() + return str.replace(/^\s+|\s+$/g, '') +} + // slice(start, end) function clamp (index, len, defaultValue) { if (typeof index !== 'number') return defaultValue -- 2.34.1