@async-generators/terminator
Advanced tools
Comparing version 0.1.1 to 0.2.0
@@ -8,4 +8,6 @@ "use strict"; | ||
const it = source[Symbol.asyncIterator](); | ||
const $return = it.return; | ||
it.return = function (value) { | ||
return it.next(Symbol.for("terminated")); | ||
it.next(Symbol.for("terminated")); | ||
return $return.call(it); | ||
}; | ||
@@ -20,4 +22,6 @@ return it; | ||
const it = source[Symbol.iterator](); | ||
const $return = it.return; | ||
it.return = function (value) { | ||
return it.next(Symbol.for("terminated")); | ||
it.next(Symbol.for("terminated")); | ||
return $return.call(it); | ||
}; | ||
@@ -24,0 +28,0 @@ return it; |
@@ -6,4 +6,6 @@ export default function (source) { | ||
const it = source[Symbol.asyncIterator](); | ||
const $return = it.return; | ||
it.return = function (value) { | ||
return it.next(Symbol.for("terminated")); | ||
it.next(Symbol.for("terminated")); | ||
return $return.call(it); | ||
}; | ||
@@ -18,4 +20,6 @@ return it; | ||
const it = source[Symbol.iterator](); | ||
const $return = it.return; | ||
it.return = function (value) { | ||
return it.next(Symbol.for("terminated")); | ||
it.next(Symbol.for("terminated")); | ||
return $return.call(it); | ||
}; | ||
@@ -22,0 +26,0 @@ return it; |
{ | ||
"name": "@async-generators/terminator", | ||
"description": "inform an iterator when it is prematurely terminated by the consumer.", | ||
"version": "0.1.1", | ||
"version": "0.2.0", | ||
"author": { | ||
@@ -6,0 +6,0 @@ "name": "Meirion Hughes", |
@@ -11,5 +11,7 @@ export default function <T>(source: Iterable<T>): Iterable<T>; | ||
const it = source[Symbol.asyncIterator](); | ||
const $return = it.return; | ||
it.return = function (value) { | ||
return it.next(Symbol.for("terminated")); | ||
} | ||
it.next(Symbol.for("terminated")); | ||
return $return.call(it) | ||
}; | ||
return it; | ||
@@ -22,5 +24,7 @@ } | ||
const it = source[Symbol.iterator](); | ||
const $return = it.return; | ||
it.return = function (value) { | ||
return it.next(Symbol.for("terminated")); | ||
} | ||
it.next(Symbol.for("terminated")); | ||
return $return.call(it); | ||
}; | ||
return it; | ||
@@ -27,0 +31,0 @@ } |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
11265
96