From 4fad8c3cc87adec0f5e5ac4bf6884002b5054170 Mon Sep 17 00:00:00 2001 From: BIGSUS24 <152616194+BIGSUS24@users.noreply.github.com> Date: Sat, 26 Sep 2026 01:56:19 +0530 Subject: [PATCH] doc: document return value of dgram.Socket methods Both `socket.bind()` overloads and `socket.close()` return the socket itself, but neither documents a return value, while `socket.ref()` and `socket.unref()` in the same file already document `Returns: {dgram.Socket}`. Verified against lib/dgram.js, where every terminal path of `Socket.prototype.bind()` and `Socket.prototype.close()` returns `this`, and at runtime on v22.14.0, where `s.bind(0) === s`, `s.bind({ port: 0 }) === s` and `s.close() === s`. Signed-off-by: BIGSUS24 <152616194+BIGSUS24@users.noreply.github.com> Assisted-by: a closed-source coding agent --- doc/api/dgram.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/doc/api/dgram.md b/doc/api/dgram.md index 79f8e3189b3..9892c8599ca 100644 --- a/doc/api/dgram.md +++ b/doc/api/dgram.md @@ -241,6 +241,7 @@ changes: * `port` {integer} * `address` {string} * `callback` {Function} with no parameters. Called when binding is complete. +* Returns: {dgram.Socket} The socket itself. For UDP sockets, causes the `dgram.Socket` to listen for datagram messages on a named `port` and optional `address`. If `port` is not @@ -319,6 +320,7 @@ added: v0.11.14 * `exclusive` {boolean} * `fd` {integer} * `callback` {Function} +* Returns: {dgram.Socket} The socket itself. For UDP sockets, causes the `dgram.Socket` to listen for datagram messages on a named `port` and optional `address` that are passed as @@ -410,6 +412,7 @@ added: v0.1.99 --> * `callback` {Function} Called when the socket has been closed. +* Returns: {dgram.Socket} The socket itself. Close the underlying socket and stop listening for data on it. If a callback is provided, it is added as a listener for the [`'close'`][] event.