From: Feross Aboukhadijeh Date: Wed, 7 May 2014 22:20:56 +0000 (-0700) Subject: Buffer#fill should be chainable X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=d873301e16b4ab5e62365069d4d95c8795b2cbec;p=buffer.git Buffer#fill should be chainable --- 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