Browse Source

Misc refactoring of Buffer#concat()

v1.x
Tj Holowaychuk 14 years ago
parent
commit
61cab9efbd
  1. 14
      lib/buffer.js

14
lib/buffer.js

@ -6,17 +6,17 @@
*/ */
/** /**
* Concatenate `this` Buffer with `buf`. * Concatenate `this` Buffer with `other`.
* *
* @param {Buffer} buf * @param {Buffer} other
* @return {Buffer} * @return {Buffer}
* @api public * @api public
*/ */
Buffer.prototype.concat = function(buf) { Buffer.prototype.concat = function(other) {
var len = this.length var len = this.length
, tmp = new Buffer(len + buf.length); , buf = new Buffer(len + other.length);
this.copy(tmp, 0, 0); this.copy(buf, 0, 0);
buf.copy(tmp, len, 0); other.copy(buf, len, 0);
return tmp; return buf;
}; };
Loading…
Cancel
Save