UNPKG

lazzy.ts

Version:

Fast and lightweight library for lazy operations with iterable objects.

218 lines 10.4 kB
"use strict"; var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) { if (k2 === undefined) k2 = k; Object.defineProperty(o, k2, { enumerable: true, get: function() { return m[k]; } }); }) : (function(o, m, k, k2) { if (k2 === undefined) k2 = k; o[k2] = m[k]; })); var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) { Object.defineProperty(o, "default", { enumerable: true, value: v }); }) : function(o, v) { o["default"] = v; }); var __importStar = (this && this.__importStar) || function (mod) { if (mod && mod.__esModule) return mod; var result = {}; if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k); __setModuleDefault(result, mod); return result; }; var __classPrivateFieldSet = (this && this.__classPrivateFieldSet) || function (receiver, state, value, kind, f) { if (kind === "m") throw new TypeError("Private method is not writable"); if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a setter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot write private member to an object whose class did not declare it"); return (kind === "a" ? f.call(receiver, value) : f ? f.value = value : state.set(receiver, value)), value; }; var __classPrivateFieldGet = (this && this.__classPrivateFieldGet) || function (receiver, state, kind, f) { if (kind === "a" && !f) throw new TypeError("Private accessor was defined without a getter"); if (typeof state === "function" ? receiver !== state || !f : !state.has(receiver)) throw new TypeError("Cannot read private member from an object whose class did not declare it"); return kind === "m" ? f : kind === "a" ? f.call(receiver) : f ? f.value : state.get(receiver); }; var _ChainAsync_source, _a; Object.defineProperty(exports, "__esModule", { value: true }); exports.ChainAsync = void 0; const λ = __importStar(require("../generators")); const γ = __importStar(require("../consumers")); const _1 = require("."); class ChainAsync { constructor(source) { _ChainAsync_source.set(this, void 0); this[_a] = () => __classPrivateFieldGet(this, _ChainAsync_source, "f"); __classPrivateFieldSet(this, _ChainAsync_source, source, "f"); } //#region Generators append(...iterables) { return new ChainAsync(λ.appendAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), ...iterables)); } at(index) { return new ChainAsync(λ.atAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), index)); } balancedChunk(target, ...select) { return new ChainAsync(λ.balancedChunkAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), target, ...select)); } chunk(size) { return new ChainAsync(λ.chunkAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), size)); } concat(...iterators) { return new ChainAsync(λ.concatAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), ...iterators)); } custom(generator) { return new ChainAsync(generator(__classPrivateFieldGet(this, _ChainAsync_source, "f"))); } distinct(...select) { return new ChainAsync(λ.distinctAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), ...select)); } feed(from) { return new ChainAsync(λ.feedAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), from)); } fill(values, start, end) { return new ChainAsync(λ.fillAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), values, start, end)); } filter(predicate) { return new ChainAsync(λ.filterAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate)); } filterWithIndex(predicate) { return new ChainAsync(λ.filterWithIndexAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate)); } flat(depth = 20) { return new ChainAsync(λ.flatAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), depth)); } flatMap(transformer, depth = 20) { return new ChainAsync(λ.flatMapAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), transformer, depth)); } forEach(action) { return new ChainAsync(λ.forEachAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), action)); } groupBy(keySelector, elementSelector, resultSelector) { return new ChainAsync(λ.groupByAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), keySelector, elementSelector, resultSelector)); } indices(predicate) { return new ChainAsync(λ.indicesAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate)); } lazyChunk(size) { return new ChainAsync(λ.lazyChunkAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), size)); } lazyGroupBy(keySelector, elementSelector, resultSelector) { return new ChainAsync(λ.lazyGroupByAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), keySelector, elementSelector, resultSelector)); } lazyPartition(predicate) { return new _1.Chain(λ.lazyPartitionAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate)); } map(transformer) { return new ChainAsync(λ.mapAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), transformer)); } prepend(...iterables) { return new ChainAsync(λ.prependAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), ...iterables)); } repeat(count) { return new ChainAsync(λ.repeatAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), count)); } skip(count) { return new ChainAsync(λ.skipAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), count)); } skipWhile(predicate) { return new ChainAsync(λ.skipWhileAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate)); } sort(...comparer) { return new ChainAsync(λ.sortAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), ...comparer)); } splice(start, deleteCount, ...items) { return new ChainAsync(λ.spliceAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), start, deleteCount, ...items)); } spread() { return new ChainAsync(λ.spreadAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"))); } take(count) { return new ChainAsync(λ.takeAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), count)); } takeWhile(predicate) { return new ChainAsync(λ.takeWhileAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate)); } zip(iterator2, resultSelector) { return new ChainAsync(λ.zipAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), iterator2, resultSelector)); } //#endregion //#region Consumers average(...select) { return γ.averageAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), ...select); } count() { return γ.countAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f")); } every(predicate) { return γ.everyAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate); } first(predicate) { return γ.firstAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate); } firstWithIndex(predicate) { return γ.firstWithIndexAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate); } includes(predicate) { return γ.includesAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate); } indexOf(predicate) { return γ.indexOfAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate); } join(separator, ...select) { return γ.joinAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), separator, ...select); } last(predicate) { return γ.lastAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate); } lastIndexOf(predicate) { return γ.lastIndexOfAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate); } lastWithIndex(predicate) { return γ.lastWithIndexAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate); } max(...select) { return γ.maxAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), ...select); } min(...select) { return γ.minAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), ...select); } partition(predicate) { return γ.partitionAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), predicate); } product(...select) { return γ.productAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), ...select); } promiseAll() { return γ.promiseAll(__classPrivateFieldGet(this, _ChainAsync_source, "f")); } reduce(reducer, initial) { return γ.reduceAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), reducer, initial); } run() { return γ.runAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f")); } sum(...select) { return γ.sumAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), ...select); } toArray() { return γ.toArrayAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f")); } toAsyncIterator() { return __classPrivateFieldGet(this, _ChainAsync_source, "f"); } toMap(select) { return γ.toMapAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), select); } toSet() { return γ.toSetAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f")); } toWeakMap(select) { return γ.toWeakMapAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), select); } toWeakSet(...select) { return γ.toWeakSetAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), ...select); } uppend(iterator, equals) { return γ.uppendAsync(__classPrivateFieldGet(this, _ChainAsync_source, "f"), iterator, equals); } } exports.ChainAsync = ChainAsync; _ChainAsync_source = new WeakMap(), _a = Symbol.asyncIterator; //# sourceMappingURL=chainAsync.js.map