Skip to content

Commit 15cc2b6

Browse files
committed
stream: update comment to indicate unused API
destroy w/ callback was previously used by node core. This is no longer the case and the comments should reflect this to avoid confusion. PR-URL: #32808 Reviewed-By: Luigi Pinca <luigipinca@gmail.com> Reviewed-By: Matteo Collina <matteo.collina@gmail.com>
1 parent b61488f commit 15cc2b6

File tree

1 file changed

+2
-4
lines changed

1 file changed

+2
-4
lines changed

lib/internal/streams/destroy.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,13 @@
11
'use strict';
22

3-
// Undocumented cb() API, needed for core, not for public API.
4-
// The cb() will be invoked synchronously if _destroy is synchronous.
5-
// If cb is passed no 'error' event will be emitted.
3+
// Backwards compat. cb() is undocumented and unused in core but
4+
// unfortunately might be used by modules.
65
function destroy(err, cb) {
76
const r = this._readableState;
87
const w = this._writableState;
98

109
if ((w && w.destroyed) || (r && r.destroyed)) {
1110
if (typeof cb === 'function') {
12-
// TODO(ronag): Invoke with `'close'`/`'error'`.
1311
cb();
1412
}
1513

0 commit comments

Comments
 (0)