// slice(start, end)
Buffer.prototype.slice = function (start, end) {
- if (!end) end = this.length;
+ if (end === undefined) end = this.length;
if (end > this.length) throw new Error("oob");
if (start > end) throw new Error("oob");
assert.equal(14, Buffer.byteLength("Il était tué", "utf8"));
assert.equal(12, Buffer.byteLength("Il était tué", "ascii"));
assert.equal(12, Buffer.byteLength("Il était tué", "binary"));
+
+
+// slice(0,0).length === 0
+assert.equal(0, Buffer('hello').slice(0, 0).length)