@bodar/totallylazy
Advanced tools
Comparing version 0.146.30 to 0.147.31
@@ -1,1 +0,1 @@ | ||
{"name":"@bodar/totallylazy","version":"0.146.30","description":"Totallylazy","repository":"git@github.com:bodar/totallylazy.js.git","author":"Daniel Worthington-Bodart <dan@bodar.com>","license":"Apache-2.0","private":false,"scripts":{"build":"ts-node build.ts"},"dependencies":{"@types/node":"^9.4.6","@types/text-encoding":"^0.0.32"},"devDependencies":{"@types/chai":"^4.1.2","@types/mocha":"^2.2.48","@types/puppeteer":"^1.3.2","chai":"^4.1.2","fuse-box":"^3.1.3","mocha":"^5.0.0","mocha-headless-chrome":"^1.8.2","ts-node":"^4.1.0","typescript":"^2.7.2","uglify-es":"^3.3.10","uglify-js":"^3.3.10"},"optionalDependencies":{"http-shutdown":"^1.2.0","text-encoding":"^0.6.4"}} | ||
{"name":"@bodar/totallylazy","version":"0.147.31","description":"Totallylazy","repository":"git@github.com:bodar/totallylazy.js.git","author":"Daniel Worthington-Bodart <dan@bodar.com>","license":"Apache-2.0","private":false,"scripts":{"build":"ts-node build.ts"},"dependencies":{"@types/node":"^9.4.6","@types/text-encoding":"^0.0.32"},"devDependencies":{"@types/chai":"^4.1.2","@types/mocha":"^2.2.48","@types/puppeteer":"^1.3.2","chai":"^4.1.2","fuse-box":"^3.1.3","mocha":"^5.0.0","mocha-headless-chrome":"^1.8.2","ts-node":"^4.1.0","typescript":"^2.7.2","uglify-es":"^3.3.10","uglify-js":"^3.3.10"},"optionalDependencies":{"http-shutdown":"^1.2.0","text-encoding":"^0.6.4"}} |
@@ -385,2 +385,62 @@ "use strict"; | ||
exports.map = map; | ||
var ZipTransducer = /** @class */ (function (_super) { | ||
tslib_1.__extends(ZipTransducer, _super); | ||
function ZipTransducer(other) { | ||
var _this = _super.call(this) || this; | ||
_this.other = other; | ||
return _this; | ||
} | ||
ZipTransducer.prototype.async_ = function (iterable) { | ||
return tslib_1.__asyncGenerator(this, arguments, function async_4() { | ||
var iteratorA, iteratorB, _a, resultA, resultB; | ||
return tslib_1.__generator(this, function (_b) { | ||
switch (_b.label) { | ||
case 0: | ||
if (!collections_1.isAsyncIterable(this.other)) | ||
throw new Error("Unsupported operation exception"); | ||
iteratorA = iterable[Symbol.asyncIterator](); | ||
iteratorB = this.other[Symbol.asyncIterator](); | ||
_b.label = 1; | ||
case 1: | ||
if (!true) return [3 /*break*/, 4]; | ||
return [4 /*yield*/, tslib_1.__await(Promise.all([iteratorA.next(), iteratorB.next()]))]; | ||
case 2: | ||
_a = tslib_1.__read.apply(void 0, [_b.sent(), 2]), resultA = _a[0], resultB = _a[1]; | ||
if (resultA.done || resultB.done) | ||
return [2 /*return*/]; | ||
return [4 /*yield*/, [resultA.value, resultB.value]]; | ||
case 3: | ||
_b.sent(); | ||
return [3 /*break*/, 1]; | ||
case 4: return [2 /*return*/]; | ||
} | ||
}); | ||
}); | ||
}; | ||
ZipTransducer.prototype.sync = function (iterable) { | ||
var iteratorA, iteratorB, resultA, resultB; | ||
return tslib_1.__generator(this, function (_a) { | ||
switch (_a.label) { | ||
case 0: | ||
if (!collections_1.isIterable(this.other)) | ||
throw new Error("Unsupported operation exception"); | ||
iteratorA = iterable[Symbol.iterator](); | ||
iteratorB = this.other[Symbol.iterator](); | ||
_a.label = 1; | ||
case 1: | ||
if (!true) return [3 /*break*/, 3]; | ||
resultA = iteratorA.next(), resultB = iteratorB.next(); | ||
if (resultA.done || resultB.done) | ||
return [2 /*return*/]; | ||
return [4 /*yield*/, [resultA.value, resultB.value]]; | ||
case 2: | ||
_a.sent(); | ||
return [3 /*break*/, 1]; | ||
case 3: return [2 /*return*/]; | ||
} | ||
}); | ||
}; | ||
return ZipTransducer; | ||
}(Transducer)); | ||
exports.ZipTransducer = ZipTransducer; | ||
var FlatMapTransducer = /** @class */ (function (_super) { | ||
@@ -394,3 +454,3 @@ tslib_1.__extends(FlatMapTransducer, _super); | ||
FlatMapTransducer.prototype.async_ = function (iterable) { | ||
return tslib_1.__asyncGenerator(this, arguments, function async_4() { | ||
return tslib_1.__asyncGenerator(this, arguments, function async_5() { | ||
var iterable_7, iterable_7_1, a, e_7_1, e_7, _a; | ||
@@ -485,3 +545,3 @@ return tslib_1.__generator(this, function (_b) { | ||
FilterTransducer.prototype.async_ = function (iterable) { | ||
return tslib_1.__asyncGenerator(this, arguments, function async_5() { | ||
return tslib_1.__asyncGenerator(this, arguments, function async_6() { | ||
var iterable_9, iterable_9_1, a, e_9_1, e_9, _a; | ||
@@ -644,3 +704,3 @@ return tslib_1.__generator(this, function (_b) { | ||
ScanTransducer.prototype.async_ = function (iterable) { | ||
return tslib_1.__asyncGenerator(this, arguments, function async_6() { | ||
return tslib_1.__asyncGenerator(this, arguments, function async_7() { | ||
var iterable_11, iterable_11_1, a, e_11_1, e_11, _a; | ||
@@ -738,3 +798,3 @@ return tslib_1.__generator(this, function (_b) { | ||
TakeTransducer.prototype.async_ = function (iterable) { | ||
return tslib_1.__asyncGenerator(this, arguments, function async_7() { | ||
return tslib_1.__asyncGenerator(this, arguments, function async_8() { | ||
var iterable_13, iterable_13_1, a, e_13_1, e_13, _a; | ||
@@ -840,3 +900,3 @@ return tslib_1.__generator(this, function (_b) { | ||
TakeWhileTransducer.prototype.async_ = function (iterable) { | ||
return tslib_1.__asyncGenerator(this, arguments, function async_8() { | ||
return tslib_1.__asyncGenerator(this, arguments, function async_9() { | ||
var iterable_15, iterable_15_1, a, e_15_1, e_15, _a; | ||
@@ -934,3 +994,3 @@ return tslib_1.__generator(this, function (_b) { | ||
SortTransducer.prototype.async_ = function (iterable) { | ||
return tslib_1.__asyncGenerator(this, arguments, function async_9() { | ||
return tslib_1.__asyncGenerator(this, arguments, function async_10() { | ||
var result; | ||
@@ -937,0 +997,0 @@ return tslib_1.__generator(this, function (_a) { |
@@ -208,2 +208,30 @@ import { | ||
export class ZipTransducer<A, B> extends Transducer<A, [A, B]> { | ||
constructor(public other: Iterable<B>|AsyncIterable<B>) { | ||
super(); | ||
} | ||
async* async_(iterable: AsyncIterable<A>): AsyncIterable<[A, B]> { | ||
if(!isAsyncIterable(this.other)) throw new Error("Unsupported operation exception"); | ||
const iteratorA = iterable[Symbol.asyncIterator](); | ||
const iteratorB = this.other[Symbol.asyncIterator](); | ||
while (true) { | ||
const [resultA, resultB] = await Promise.all([iteratorA.next(), iteratorB.next()]); | ||
if (resultA.done || resultB.done) return; | ||
yield [resultA.value, resultB.value]; | ||
} | ||
} | ||
* sync(iterable: Iterable<A>): Iterable<[A, B]> { | ||
if(!isIterable(this.other)) throw new Error("Unsupported operation exception"); | ||
const iteratorA = iterable[Symbol.iterator](); | ||
const iteratorB = this.other[Symbol.iterator](); | ||
while (true) { | ||
const resultA = iteratorA.next(), resultB = iteratorB.next(); | ||
if (resultA.done || resultB.done) return; | ||
yield [resultA.value, resultB.value]; | ||
} | ||
} | ||
} | ||
export class FlatMapTransducer<A, B> extends Transducer<A, B> { | ||
@@ -210,0 +238,0 @@ constructor(public mapper: Mapper<A, Contract<B>>) { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
1828357
27583