ts-async-iterable-functions
Advanced tools
Comparing version 3.0.1 to 3.0.2
"use strict"; | ||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) { | ||
return new (P || (P = Promise))(function (resolve, reject) { | ||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } | ||
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } | ||
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); } | ||
step((generator = generator.apply(thisArg, _arguments || [])).next()); | ||
}); | ||
}; | ||
var __generator = (this && this.__generator) || function (thisArg, body) { | ||
@@ -48,62 +56,87 @@ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; | ||
}; | ||
var __read = (this && this.__read) || function (o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
var ts_functional_pipe_1 = require("ts-functional-pipe"); | ||
var merge_1 = require("./merge"); | ||
var take_1 = require("./take"); | ||
var ts_async_iterable_queue_1 = require("ts-async-iterable-queue"); | ||
function _takeUntil(src, other) { | ||
return __asyncGenerator(this, arguments, function _takeUntil_1() { | ||
var e_1, _a, _b, _c, _d, srcItem, otherItem, e_1_1; | ||
return __generator(this, function (_e) { | ||
switch (_e.label) { | ||
var pr, it, r, _a, e_1; | ||
var _this = this; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_e.trys.push([0, 7, 8, 13]); | ||
_b = __asyncValues(merge_1._merge(src, take_1._take(other, 1))); | ||
_e.label = 1; | ||
case 1: return [4 /*yield*/, __await(_b.next())]; | ||
case 2: | ||
if (!(_c = _e.sent(), !_c.done)) return [3 /*break*/, 6]; | ||
_d = __read(_c.value, 2), srcItem = _d[0], otherItem = _d[1]; | ||
if (otherItem !== undefined) { | ||
return [3 /*break*/, 6]; | ||
pr = ts_async_iterable_queue_1.createPromiseResolver(); | ||
(function () { return __awaiter(_this, void 0, void 0, function () { | ||
var e_2, _a, _b, _c, _1, e_2_1; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
_d.trys.push([0, 5, 6, 11]); | ||
_b = __asyncValues(take_1._take(other, 1)); | ||
_d.label = 1; | ||
case 1: return [4 /*yield*/, _b.next()]; | ||
case 2: | ||
if (!(_c = _d.sent(), !_c.done)) return [3 /*break*/, 4]; | ||
_1 = _c.value; | ||
pr.resolve(); | ||
_d.label = 3; | ||
case 3: return [3 /*break*/, 1]; | ||
case 4: return [3 /*break*/, 11]; | ||
case 5: | ||
e_2_1 = _d.sent(); | ||
e_2 = { error: e_2_1 }; | ||
return [3 /*break*/, 11]; | ||
case 6: | ||
_d.trys.push([6, , 9, 10]); | ||
if (!(_c && !_c.done && (_a = _b.return))) return [3 /*break*/, 8]; | ||
return [4 /*yield*/, _a.call(_b)]; | ||
case 7: | ||
_d.sent(); | ||
_d.label = 8; | ||
case 8: return [3 /*break*/, 10]; | ||
case 9: | ||
if (e_2) throw e_2.error; | ||
return [7 /*endfinally*/]; | ||
case 10: return [7 /*endfinally*/]; | ||
case 11: return [2 /*return*/]; | ||
} | ||
}); | ||
}); })(); | ||
it = src[Symbol.asyncIterator](); | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 10, , 11]); | ||
_b.label = 2; | ||
case 2: return [4 /*yield*/, __await(Promise.race([pr.promise, it.next()]))]; | ||
case 3: | ||
r = _b.sent(); | ||
if (typeof r === 'undefined') { | ||
return [3 /*break*/, 7]; | ||
} | ||
return [4 /*yield*/, __await(srcItem)]; | ||
case 3: return [4 /*yield*/, _e.sent()]; | ||
case 4: | ||
_e.sent(); | ||
_e.label = 5; | ||
case 5: return [3 /*break*/, 1]; | ||
case 6: return [3 /*break*/, 13]; | ||
/* istanbul ignore if */ | ||
if (r.done) { | ||
return [3 /*break*/, 7]; | ||
} | ||
return [4 /*yield*/, __await(r.value)]; | ||
case 4: return [4 /*yield*/, _b.sent()]; | ||
case 5: | ||
_b.sent(); | ||
_b.label = 6; | ||
case 6: return [3 /*break*/, 2]; | ||
case 7: | ||
e_1_1 = _e.sent(); | ||
e_1 = { error: e_1_1 }; | ||
return [3 /*break*/, 13]; | ||
_a = it.return; | ||
if (!_a) return [3 /*break*/, 9]; | ||
return [4 /*yield*/, __await(it.return())]; | ||
case 8: | ||
_e.trys.push([8, , 11, 12]); | ||
if (!(_c && !_c.done && (_a = _b.return))) return [3 /*break*/, 10]; | ||
return [4 /*yield*/, __await(_a.call(_b))]; | ||
_a = (_b.sent()); | ||
_b.label = 9; | ||
case 9: | ||
_e.sent(); | ||
_e.label = 10; | ||
case 10: return [3 /*break*/, 12]; | ||
case 11: | ||
if (e_1) throw e_1.error; | ||
return [7 /*endfinally*/]; | ||
case 12: return [7 /*endfinally*/]; | ||
case 13: return [2 /*return*/]; | ||
_a; | ||
return [3 /*break*/, 11]; | ||
case 10: | ||
e_1 = _b.sent(); | ||
/* istanbul ignore next */ | ||
it.throw && it.throw(e_1); | ||
return [3 /*break*/, 11]; | ||
case 11: return [2 /*return*/]; | ||
} | ||
@@ -110,0 +143,0 @@ }); |
@@ -64,19 +64,2 @@ /*! ***************************************************************************** | ||
function __read(o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
} | ||
function __await(v) { | ||
@@ -121,3 +104,3 @@ return this instanceof __await ? (this.v = v, this) : new __await(v); | ||
function __read$1(o, n) { | ||
function __read(o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
@@ -141,3 +124,3 @@ if (!m) return o; | ||
for (var ar = [], i = 0; i < arguments.length; i++) | ||
ar = ar.concat(__read$1(arguments[i])); | ||
ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
@@ -1128,40 +1111,80 @@ } | ||
return __asyncGenerator(this, arguments, function _takeUntil_1() { | ||
var e_1, _a, _b, _c, _d, srcItem, otherItem, e_1_1; | ||
return __generator(this, function (_e) { | ||
switch (_e.label) { | ||
var pr, it, r, _a, e_1; | ||
var _this = this; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_e.trys.push([0, 7, 8, 13]); | ||
_b = __asyncValues(_merge(src, _take(other, 1))); | ||
_e.label = 1; | ||
case 1: return [4 /*yield*/, __await(_b.next())]; | ||
case 2: | ||
if (!(_c = _e.sent(), !_c.done)) return [3 /*break*/, 6]; | ||
_d = __read(_c.value, 2), srcItem = _d[0], otherItem = _d[1]; | ||
if (otherItem !== undefined) { | ||
return [3 /*break*/, 6]; | ||
pr = createPromiseResolver(); | ||
(function () { return __awaiter(_this, void 0, void 0, function () { | ||
var e_2, _a, _b, _c, _1, e_2_1; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
_d.trys.push([0, 5, 6, 11]); | ||
_b = __asyncValues(_take(other, 1)); | ||
_d.label = 1; | ||
case 1: return [4 /*yield*/, _b.next()]; | ||
case 2: | ||
if (!(_c = _d.sent(), !_c.done)) return [3 /*break*/, 4]; | ||
_1 = _c.value; | ||
pr.resolve(); | ||
_d.label = 3; | ||
case 3: return [3 /*break*/, 1]; | ||
case 4: return [3 /*break*/, 11]; | ||
case 5: | ||
e_2_1 = _d.sent(); | ||
e_2 = { error: e_2_1 }; | ||
return [3 /*break*/, 11]; | ||
case 6: | ||
_d.trys.push([6, , 9, 10]); | ||
if (!(_c && !_c.done && (_a = _b.return))) return [3 /*break*/, 8]; | ||
return [4 /*yield*/, _a.call(_b)]; | ||
case 7: | ||
_d.sent(); | ||
_d.label = 8; | ||
case 8: return [3 /*break*/, 10]; | ||
case 9: | ||
if (e_2) throw e_2.error; | ||
return [7 /*endfinally*/]; | ||
case 10: return [7 /*endfinally*/]; | ||
case 11: return [2 /*return*/]; | ||
} | ||
}); | ||
}); })(); | ||
it = src[Symbol.asyncIterator](); | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 10, , 11]); | ||
_b.label = 2; | ||
case 2: return [4 /*yield*/, __await(Promise.race([pr.promise, it.next()]))]; | ||
case 3: | ||
r = _b.sent(); | ||
if (typeof r === 'undefined') { | ||
return [3 /*break*/, 7]; | ||
} | ||
return [4 /*yield*/, __await(srcItem)]; | ||
case 3: return [4 /*yield*/, _e.sent()]; | ||
case 4: | ||
_e.sent(); | ||
_e.label = 5; | ||
case 5: return [3 /*break*/, 1]; | ||
case 6: return [3 /*break*/, 13]; | ||
/* istanbul ignore if */ | ||
if (r.done) { | ||
return [3 /*break*/, 7]; | ||
} | ||
return [4 /*yield*/, __await(r.value)]; | ||
case 4: return [4 /*yield*/, _b.sent()]; | ||
case 5: | ||
_b.sent(); | ||
_b.label = 6; | ||
case 6: return [3 /*break*/, 2]; | ||
case 7: | ||
e_1_1 = _e.sent(); | ||
e_1 = { error: e_1_1 }; | ||
return [3 /*break*/, 13]; | ||
_a = it.return; | ||
if (!_a) return [3 /*break*/, 9]; | ||
return [4 /*yield*/, __await(it.return())]; | ||
case 8: | ||
_e.trys.push([8, , 11, 12]); | ||
if (!(_c && !_c.done && (_a = _b.return))) return [3 /*break*/, 10]; | ||
return [4 /*yield*/, __await(_a.call(_b))]; | ||
_a = (_b.sent()); | ||
_b.label = 9; | ||
case 9: | ||
_e.sent(); | ||
_e.label = 10; | ||
case 10: return [3 /*break*/, 12]; | ||
case 11: | ||
if (e_1) throw e_1.error; | ||
return [7 /*endfinally*/]; | ||
case 12: return [7 /*endfinally*/]; | ||
case 13: return [2 /*return*/]; | ||
return [3 /*break*/, 11]; | ||
case 10: | ||
e_1 = _b.sent(); | ||
/* istanbul ignore next */ | ||
it.throw && it.throw(e_1); | ||
return [3 /*break*/, 11]; | ||
case 11: return [2 /*return*/]; | ||
} | ||
@@ -1168,0 +1191,0 @@ }); |
@@ -70,19 +70,2 @@ (function (global, factory) { | ||
function __read(o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
if (!m) return o; | ||
var i = m.call(o), r, ar = [], e; | ||
try { | ||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); | ||
} | ||
catch (error) { e = { error: error }; } | ||
finally { | ||
try { | ||
if (r && !r.done && (m = i["return"])) m.call(i); | ||
} | ||
finally { if (e) throw e.error; } | ||
} | ||
return ar; | ||
} | ||
function __await(v) { | ||
@@ -127,3 +110,3 @@ return this instanceof __await ? (this.v = v, this) : new __await(v); | ||
function __read$1(o, n) { | ||
function __read(o, n) { | ||
var m = typeof Symbol === "function" && o[Symbol.iterator]; | ||
@@ -147,3 +130,3 @@ if (!m) return o; | ||
for (var ar = [], i = 0; i < arguments.length; i++) | ||
ar = ar.concat(__read$1(arguments[i])); | ||
ar = ar.concat(__read(arguments[i])); | ||
return ar; | ||
@@ -1134,40 +1117,80 @@ } | ||
return __asyncGenerator(this, arguments, function _takeUntil_1() { | ||
var e_1, _a, _b, _c, _d, srcItem, otherItem, e_1_1; | ||
return __generator(this, function (_e) { | ||
switch (_e.label) { | ||
var pr, it, r, _a, e_1; | ||
var _this = this; | ||
return __generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
_e.trys.push([0, 7, 8, 13]); | ||
_b = __asyncValues(_merge(src, _take(other, 1))); | ||
_e.label = 1; | ||
case 1: return [4 /*yield*/, __await(_b.next())]; | ||
case 2: | ||
if (!(_c = _e.sent(), !_c.done)) return [3 /*break*/, 6]; | ||
_d = __read(_c.value, 2), srcItem = _d[0], otherItem = _d[1]; | ||
if (otherItem !== undefined) { | ||
return [3 /*break*/, 6]; | ||
pr = createPromiseResolver(); | ||
(function () { return __awaiter(_this, void 0, void 0, function () { | ||
var e_2, _a, _b, _c, _1, e_2_1; | ||
return __generator(this, function (_d) { | ||
switch (_d.label) { | ||
case 0: | ||
_d.trys.push([0, 5, 6, 11]); | ||
_b = __asyncValues(_take(other, 1)); | ||
_d.label = 1; | ||
case 1: return [4 /*yield*/, _b.next()]; | ||
case 2: | ||
if (!(_c = _d.sent(), !_c.done)) return [3 /*break*/, 4]; | ||
_1 = _c.value; | ||
pr.resolve(); | ||
_d.label = 3; | ||
case 3: return [3 /*break*/, 1]; | ||
case 4: return [3 /*break*/, 11]; | ||
case 5: | ||
e_2_1 = _d.sent(); | ||
e_2 = { error: e_2_1 }; | ||
return [3 /*break*/, 11]; | ||
case 6: | ||
_d.trys.push([6, , 9, 10]); | ||
if (!(_c && !_c.done && (_a = _b.return))) return [3 /*break*/, 8]; | ||
return [4 /*yield*/, _a.call(_b)]; | ||
case 7: | ||
_d.sent(); | ||
_d.label = 8; | ||
case 8: return [3 /*break*/, 10]; | ||
case 9: | ||
if (e_2) throw e_2.error; | ||
return [7 /*endfinally*/]; | ||
case 10: return [7 /*endfinally*/]; | ||
case 11: return [2 /*return*/]; | ||
} | ||
}); | ||
}); })(); | ||
it = src[Symbol.asyncIterator](); | ||
_b.label = 1; | ||
case 1: | ||
_b.trys.push([1, 10, , 11]); | ||
_b.label = 2; | ||
case 2: return [4 /*yield*/, __await(Promise.race([pr.promise, it.next()]))]; | ||
case 3: | ||
r = _b.sent(); | ||
if (typeof r === 'undefined') { | ||
return [3 /*break*/, 7]; | ||
} | ||
return [4 /*yield*/, __await(srcItem)]; | ||
case 3: return [4 /*yield*/, _e.sent()]; | ||
case 4: | ||
_e.sent(); | ||
_e.label = 5; | ||
case 5: return [3 /*break*/, 1]; | ||
case 6: return [3 /*break*/, 13]; | ||
/* istanbul ignore if */ | ||
if (r.done) { | ||
return [3 /*break*/, 7]; | ||
} | ||
return [4 /*yield*/, __await(r.value)]; | ||
case 4: return [4 /*yield*/, _b.sent()]; | ||
case 5: | ||
_b.sent(); | ||
_b.label = 6; | ||
case 6: return [3 /*break*/, 2]; | ||
case 7: | ||
e_1_1 = _e.sent(); | ||
e_1 = { error: e_1_1 }; | ||
return [3 /*break*/, 13]; | ||
_a = it.return; | ||
if (!_a) return [3 /*break*/, 9]; | ||
return [4 /*yield*/, __await(it.return())]; | ||
case 8: | ||
_e.trys.push([8, , 11, 12]); | ||
if (!(_c && !_c.done && (_a = _b.return))) return [3 /*break*/, 10]; | ||
return [4 /*yield*/, __await(_a.call(_b))]; | ||
_a = (_b.sent()); | ||
_b.label = 9; | ||
case 9: | ||
_e.sent(); | ||
_e.label = 10; | ||
case 10: return [3 /*break*/, 12]; | ||
case 11: | ||
if (e_1) throw e_1.error; | ||
return [7 /*endfinally*/]; | ||
case 12: return [7 /*endfinally*/]; | ||
case 13: return [2 /*return*/]; | ||
return [3 /*break*/, 11]; | ||
case 10: | ||
e_1 = _b.sent(); | ||
/* istanbul ignore next */ | ||
it.throw && it.throw(e_1); | ||
return [3 /*break*/, 11]; | ||
case 11: return [2 /*return*/]; | ||
} | ||
@@ -1174,0 +1197,0 @@ }); |
{ | ||
"name": "ts-async-iterable-functions", | ||
"version": "3.0.1", | ||
"version": "3.0.2", | ||
"description": "", | ||
@@ -5,0 +5,0 @@ "keywords": [], |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
358116
3802