Browse Source

Remove unnecessary function call

Sven Slootweg 2 months ago
parent
commit
537b132ae8
1 changed files with 4 additions and 4 deletions
  1. 4 4
      index.js

+ 4 - 4
index.js

@ -18,12 +18,10 @@ module.exports = function simpleSinkStream(_options) {
18 18
		required,
19 19
		wrapValueAsOption("onResult"), {
20 20
			onResult: [ required, isFunction ],
21
			onAbort: [ isFunction ],
21 22
			onEnd: [ isFunction, defaultTo.literal(function defaultOnEnd() {
22 23
				// We return whatever value we got last from the specified onResult callback.
23 24
				return lastResult;
24
			})],
25
			onAbort: [ isFunction, defaultTo.literal(function defaultOnAbort() {
26
				// no-op
27 25
			})]
28 26
		}
29 27
	]);
@ -88,7 +86,9 @@ module.exports = function simpleSinkStream(_options) {
88 86
					abortHandled = true;
89 87
90 88
					return Promise.try(() => {
91
						return onAbort();
89
						if (onAbort != null) {
90
							return onAbort();
91
						}
92 92
					}).then(() => {
93 93
						if (marker.reason instanceof Error) {
94 94
							// NOTE: This ensures that the original error causing the abort is thrown exactly once