linq-extensions
Version:
Linq-like extension methods for JavaScript and TypeScript builtin collections
29 lines • 881 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.LeftJoinIterable = void 0;
const iterable_1 = require("../../iterable");
class LeftJoinIterable extends iterable_1.Iterable {
constructor(left, right, on, into) {
super();
this.left = left;
this.right = right;
this.on = on;
this.into = into;
}
*[Symbol.iterator]() {
for (const left of this.left) {
let didJoin = false;
for (const right of this.right) {
if (this.on(left, right)) {
didJoin = true;
yield this.into(left, right);
}
}
if (!didJoin) {
yield this.into(left, null);
}
}
}
}
exports.LeftJoinIterable = LeftJoinIterable;
//# sourceMappingURL=left-join-iterable.js.map