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: #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 committed Feb 15, 2017
1 parent 797ec33 commit 1e21d05
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 @@ -503,12 +503,12 @@ Buffer.prototype.copy = function(target, targetStart, sourceStart, sourceEnd) {
return binding.copy(this, target, targetStart, sourceStart, sourceEnd);
};

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 1e21d05

Please sign in to comment.