From 537b132ae82aa3eb07305b2d3c3352b018a69405 Mon Sep 17 00:00:00 2001 From: Sven Slootweg Date: Mon, 20 Jul 2020 22:36:50 +0200 Subject: [PATCH] Remove unnecessary function call --- index.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/index.js b/index.js index bb1931b..72c0a88 100644 --- a/index.js +++ b/index.js @@ -18,12 +18,10 @@ module.exports = function simpleSinkStream(_options) { required, wrapValueAsOption("onResult"), { onResult: [ required, isFunction ], + onAbort: [ isFunction ], onEnd: [ isFunction, defaultTo.literal(function defaultOnEnd() { // We return whatever value we got last from the specified onResult callback. return lastResult; - })], - onAbort: [ isFunction, defaultTo.literal(function defaultOnAbort() { - // no-op })] } ]); @@ -88,7 +86,9 @@ module.exports = function simpleSinkStream(_options) { abortHandled = true; return Promise.try(() => { - return onAbort(); + if (onAbort != null) { + return onAbort(); + } }).then(() => { if (marker.reason instanceof Error) { // NOTE: This ensures that the original error causing the abort is thrown exactly once