Skip to content

Commit

Permalink
Buffer.str() renamed to Buffer.toString()
Browse files Browse the repository at this point in the history
  • Loading branch information
ry committed Oct 30, 2018
1 parent f720673 commit bc93ad3
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions js/buffer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ export class Buffer implements Reader, Writer {
return this.buf.subarray(this.off);
}

/** String returns the contents of the unread portion of the buffer
/** toString() returns the contents of the unread portion of the buffer
* as a string.
*/
str(): string {
toString(): string {
const decoder = new TextDecoder();
return decoder.decode(this.buf.subarray(this.off));
}
Expand Down
2 changes: 1 addition & 1 deletion js/buffer_test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function check(buf: Buffer, s: string) {
const decoder = new TextDecoder();
const bytesStr = decoder.decode(bytes);
assertEqual(bytesStr, s);
assertEqual(buf.length, buf.str().length);
assertEqual(buf.length, buf.toString().length);
assertEqual(buf.length, s.length);
}

Expand Down

0 comments on commit bc93ad3

Please sign in to comment.