UNPKG

@effect-ts/system

Version:

Effect-TS is a zero dependency set of libraries to write highly productive, purely functional TypeScript at scale.

51 lines (43 loc) 2.95 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.aggregateAsync = aggregateAsync; exports.aggregateAsync_ = aggregateAsync_; var SC = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("../../../../Schedule/index.js")); var AggregateAsyncWithin = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("./aggregateAsyncWithin.js")); function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function (nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); } function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; } /** * Aggregates elements of this stream using the provided sink for as long * as the downstream operators on the stream are busy. * * This operator divides the stream into two asynchronous "islands". Operators upstream * of this operator run on one fiber, while downstream operators run on another. Whenever * the downstream fiber is busy processing elements, the upstream fiber will feed elements * into the sink until it signals completion. * * Any sink can be used here, but see `Sink.foldWeightedM` and `Sink.foldUntilM` for * sinks that cover the common usecases. */ function aggregateAsync_(self, sink) { return AggregateAsyncWithin.aggregateAsyncWithin_(self, sink, SC.forever); } /** * Aggregates elements of this stream using the provided sink for as long * as the downstream operators on the stream are busy. * * This operator divides the stream into two asynchronous "islands". Operators upstream * of this operator run on one fiber, while downstream operators run on another. Whenever * the downstream fiber is busy processing elements, the upstream fiber will feed elements * into the sink until it signals completion. * * Any sink can be used here, but see `Sink.foldWeightedM` and `Sink.foldUntilM` for * sinks that cover the common usecases. * * @ets_data_first aggregateAsync_ */ function aggregateAsync(sink) { return self => aggregateAsync_(self, sink); } //# sourceMappingURL=aggregateAsync.js.map