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}
* @api public
*/
Buffer.prototype.concat = function(buf) {
Buffer.prototype.concat = function(other) {
var len = this.length
, tmp = new Buffer(len + buf.length);
this.copy(tmp, 0, 0);
buf.copy(tmp, len, 0);
return tmp;
, buf = new Buffer(len + other.length);
this.copy(buf, 0, 0);
other.copy(buf, len, 0);
return buf;
};
Loading…
Cancel
Save