|
@ -322,12 +322,9 @@ Buffer.prototype.copy = function copy (target, target_start, start, end) { |
|
|
|
|
|
|
|
|
// slice(start, end)
|
|
|
// slice(start, end)
|
|
|
Buffer.prototype.slice = function (start, end) { |
|
|
Buffer.prototype.slice = function (start, end) { |
|
|
if (end > this.length) { |
|
|
if (!end) end = this.length; |
|
|
throw new Error("oob"); |
|
|
if (end > this.length) throw new Error("oob"); |
|
|
} |
|
|
if (start > end) throw new Error("oob"); |
|
|
if (start > end) { |
|
|
|
|
|
throw new Error("oob"); |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
return new Buffer(this.parent, end - start, +start + this.offset); |
|
|
return new Buffer(this.parent, end - start, +start + this.offset); |
|
|
}; |
|
|
}; |
|
|