From 2b4815b9f7b0801ea8ec240b8eded63dde4f8ccb Mon Sep 17 00:00:00 2001 From: Robert Nagy Date: Wed, 15 Apr 2020 14:44:36 +0200 Subject: [PATCH] stream: remove unused & undocumented cb destroy(err, cb) was an undocumented API which was previously used internally by core modules. However, this is no longer the case and it should be possible to safely remove this. Refs: https://github.com/nodejs/node/pull/32808 --- lib/internal/streams/destroy.js | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/lib/internal/streams/destroy.js b/lib/internal/streams/destroy.js index 6eb46c7f7c454e..d55694b3106b3b 100644 --- a/lib/internal/streams/destroy.js +++ b/lib/internal/streams/destroy.js @@ -1,18 +1,10 @@ 'use strict'; -// Undocumented cb() API, needed for core, not for public API. -// The cb() will be invoked synchronously if _destroy is synchronous. -// If cb is passed no 'error' event will be emitted. -function destroy(err, cb) { +function destroy(err) { const r = this._readableState; const w = this._writableState; if ((w && w.destroyed) || (r && r.destroyed)) { - if (typeof cb === 'function') { - // TODO(ronag): Invoke with `'close'`/`'error'`. - cb(); - } - return this; } @@ -52,10 +44,6 @@ function destroy(err, cb) { r.closed = true; } - if (typeof cb === 'function') { - cb(err); - } - if (err) { process.nextTick(emitErrorCloseNT, this, err); } else {