UNPKG

@daiso-tech/core

Version:

The library offers flexible, framework-agnostic solutions for modern web applications, built on adaptable components that integrate seamlessly with popular frameworks like Next Js.

42 lines 1.42 kB
/** * @module Collection */ import {} from "../../../../collection/contracts/_module-exports.js"; import {} from "../../../../utilities/_module-exports.js"; import { isAsyncIterable, isIterable, } from "../../../../collection/implementations/_shared.js"; /** * @internal */ export class AsyncCrossJoinIterable { collection; iterable; makeCollection; constructor(collection, iterable, makeCollection) { this.collection = collection; this.iterable = iterable; this.makeCollection = makeCollection; } async *[Symbol.asyncIterator]() { for await (const itemA of this.collection) { for await (const itemB of this.iterable) { let collection = this.makeCollection([]); if (isIterable(itemA) || isAsyncIterable(itemA)) { collection = collection.append(itemA); } else { collection = collection.append([itemA]); } if (isIterable(itemB) || isAsyncIterable(itemB)) { collection = collection.append(itemB); } else { collection = collection.append([itemB]); } yield (await collection.toArray()); } } } } //# sourceMappingURL=async-cross-join-iterable.js.map