Commit 1726c3bd194 for nodejs
commit 1726c3bd194f15776e0aa9da0b926d3eec967852
Author: Shivam S <152616194+BIGSUS24@users.noreply.github.com>
Date: Mon Nov 30 07:33:20 2026 +0530
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
PR-URL: https://github.com/nodejs/node/pull/66300
Reviewed-By: Deokjin Kim <deokjin81.kim@gmail.com>
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.