From: Feross Aboukhadijeh Date: Fri, 20 Mar 2015 23:29:31 +0000 (-0700) Subject: style X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=a29bfebea0d7e40ac6404fa9dee17161ad1e2fa7;p=buffer.git style --- diff --git a/index.js b/index.js index a20155d..fbc0f8a 100644 --- a/index.js +++ b/index.js @@ -1016,8 +1016,6 @@ Buffer.prototype.writeDoubleBE = function writeDoubleBE (value, offset, noAssert // copy(targetBuffer, targetStart=0, sourceStart=0, sourceEnd=buffer.length) Buffer.prototype.copy = function copy (target, target_start, start, end) { - var self = this // source - if (!start) start = 0 if (!end && end !== 0) end = this.length if (target_start >= target.length) target_start = target.length @@ -1026,13 +1024,13 @@ Buffer.prototype.copy = function copy (target, target_start, start, end) { // Copy 0 bytes; we're done if (end === start) return 0 - if (target.length === 0 || self.length === 0) return 0 + if (target.length === 0 || this.length === 0) return 0 // Fatal error conditions if (target_start < 0) { throw new RangeError('targetStart out of bounds') } - if (start < 0 || start >= self.length) throw new RangeError('sourceStart out of bounds') + if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') if (end < 0) throw new RangeError('sourceEnd out of bounds') // Are we oob?