UNPKG

@connectv/core

Version:

agent-based reactive programming library for typescript/javascript

48 lines 1.71 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var rxjs_1 = require("rxjs"); var operators_1 = require("rxjs/operators"); var pipe_1 = require("./pipe"); /** * * Represents [spread](https://connective.dev/docs/spread) pins. * */ var Spread = /** @class */ (function (_super) { __extends(Spread, _super); function Spread() { return _super.call(this, [ operators_1.mergeMap(function (emission) { return (emission.value.map) ? rxjs_1.from(emission.value.map(function (v) { return emission.fork(v); })) : rxjs_1.of(emission); }) ]) || this; } return Spread; }(pipe_1.Pipe)); exports.Spread = Spread; /** * * Creates a [spread](https://connective.dev/docs/spread) pin. A spread pin can be used * to spread contents of an array over multiple emissions. * [Checkout the docs](https://connective.dev/docs/spread) for examples and further information. * */ function spread() { return new Spread(); } exports.spread = spread; exports.default = spread; //# sourceMappingURL=spread.js.map