From ec609f910ace6edfac17bc1c419b56f0c9546b1a Mon Sep 17 00:00:00 2001 From: Daniel Cousens Date: Wed, 22 Apr 2015 10:40:49 +1000 Subject: [PATCH] index: s/target_start/targetStart --- index.js | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/index.js b/index.js index c03eecd..a7989ae 100644 --- a/index.js +++ b/index.js @@ -1095,11 +1095,11 @@ 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) { +Buffer.prototype.copy = function copy (target, targetStart, start, end) { if (!start) start = 0 if (!end && end !== 0) end = this.length - if (target_start >= target.length) target_start = target.length - if (!target_start) target_start = 0 + if (targetStart >= target.length) targetStart = target.length + if (!targetStart) targetStart = 0 if (end > 0 && end < start) end = start // Copy 0 bytes; we're done @@ -1107,7 +1107,7 @@ Buffer.prototype.copy = function copy (target, target_start, start, end) { if (target.length === 0 || this.length === 0) return 0 // Fatal error conditions - if (target_start < 0) { + if (targetStart < 0) { throw new RangeError('targetStart out of bounds') } if (start < 0 || start >= this.length) throw new RangeError('sourceStart out of bounds') @@ -1115,18 +1115,18 @@ Buffer.prototype.copy = function copy (target, target_start, start, end) { // Are we oob? if (end > this.length) end = this.length - if (target.length - target_start < end - start) { - end = target.length - target_start + start + if (target.length - targetStart < end - start) { + end = target.length - targetStart + start } var len = end - start if (len < 1000 || !Buffer.TYPED_ARRAY_SUPPORT) { for (var i = 0; i < len; i++) { - target[i + target_start] = this[i + start] + target[i + targetStart] = this[i + start] } } else { - target._set(this.subarray(start, start + len), target_start) + target._set(this.subarray(start, start + len), targetStart) } return len -- 2.34.1