UNPKG

@codibre/fluent-iterable

Version:

Provides LINQ-like fluent api operations for iterables and async iterables (ES2018+).

19 lines (18 loc) 768 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.combineJoinRecipe = combineJoinRecipe; const prepare_1 = require("../types-internal/prepare"); function combineJoinRecipe(combine, map, reduce, resolver) { return function combineJoin(baseKey) { var _a; let keyA; let keyB; if (baseKey) { keyB = (0, prepare_1.prepare)(baseKey); keyA = ([a]) => keyB(a); } return ((_a = reduce.call(this, (result, nextIterable) => result ? resolver(combine.call(result, nextIterable, keyA, keyB), (combined) => map.call(combined, ([a, b]) => [...a, b])) : map.call(nextIterable, (x) => [x]), undefined)) !== null && _a !== void 0 ? _a : []); }; }