buffer: give names to Buffer.prototype.*Write() functions

PR-URL: https://github.com/nodejs/node/pull/58258
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Jordan Harband <ljharb@gmail.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Ulises Gascón <ulisesgascongonzalez@gmail.com>
This commit is contained in:
Livia Medeiros 2025-05-12 16:02:23 +09:00 committed by Antoine du Hamel
parent 5c36510dec
commit b9a16e97e0
No known key found for this signature in database
GPG Key ID: 21D900FFDB233756

View File

@ -1036,7 +1036,7 @@ function addBufferPrototypeMethods(proto) {
proto.hexSlice = hexSlice;
proto.ucs2Slice = ucs2Slice;
proto.utf8Slice = utf8Slice;
proto.asciiWrite = function(string, offset = 0, length = this.byteLength) {
proto.asciiWrite = function asciiWrite(string, offset = 0, length = this.byteLength) {
if (offset < 0 || offset > this.byteLength) {
throw new ERR_BUFFER_OUT_OF_BOUNDS('offset');
}
@ -1047,7 +1047,7 @@ function addBufferPrototypeMethods(proto) {
};
proto.base64Write = base64Write;
proto.base64urlWrite = base64urlWrite;
proto.latin1Write = function(string, offset = 0, length = this.byteLength) {
proto.latin1Write = function latin1Write(string, offset = 0, length = this.byteLength) {
if (offset < 0 || offset > this.byteLength) {
throw new ERR_BUFFER_OUT_OF_BOUNDS('offset');
}
@ -1058,7 +1058,7 @@ function addBufferPrototypeMethods(proto) {
};
proto.hexWrite = hexWrite;
proto.ucs2Write = ucs2Write;
proto.utf8Write = function(string, offset = 0, length = this.byteLength) {
proto.utf8Write = function utf8Write(string, offset = 0, length = this.byteLength) {
if (offset < 0 || offset > this.byteLength) {
throw new ERR_BUFFER_OUT_OF_BOUNDS('offset');
}