@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.
38 lines • 1.14 kB
JavaScript
/**
* @module Collection
*/
import { isIterable } from "../../../../collection/implementations/_shared.js";
/**
* @internal
*/
export class CrossJoinIterable {
collection;
iterable;
makeCollection;
constructor(collection, iterable, makeCollection) {
this.collection = collection;
this.iterable = iterable;
this.makeCollection = makeCollection;
}
*[Symbol.iterator]() {
for (const itemA of this.collection) {
for (const itemB of this.iterable) {
let collection = this.makeCollection([]);
if (isIterable(itemA)) {
collection = collection.append(itemA);
}
else {
collection = collection.append([itemA]);
}
if (isIterable(itemB)) {
collection = collection.append(itemB);
}
else {
collection = collection.append([itemB]);
}
yield collection.toArray();
}
}
}
}
//# sourceMappingURL=cross-join-iterable.js.map