Skip to content

Commit

Permalink
buffer: avoid use of arguments
Browse files Browse the repository at this point in the history
Avoid use of arguments in Buffer.prototype.toString()

PR-URL: nodejs#11358
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Сковорода Никита Андреевич <chalkerx@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Joyee Cheung <joyeec9h3@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
  • Loading branch information
jasnell authored and italoacasas committed Feb 16, 2017
1 parent c31d27f commit f9c410a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/buffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -493,12 +493,12 @@ function slowToString(encoding, start, end) {
}


Buffer.prototype.toString = function() {
Buffer.prototype.toString = function(encoding, start, end) {
let result;
if (arguments.length === 0) {
result = this.utf8Slice(0, this.length);
} else {
result = slowToString.apply(this, arguments);
result = slowToString.call(this, encoding, start, end);
}
if (result === undefined)
throw new Error('"toString()" failed');
Expand Down

0 comments on commit f9c410a

Please sign in to comment.