effect
Version:
The missing standard library for TypeScript, for writing production-grade software.
65 lines (64 loc) • 2.82 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.match = exports.isUpstreamPullRequest = exports.isPulled = exports.isNoUpstream = exports.UpstreamPullRequestTypeId = exports.Pulled = exports.NoUpstream = void 0;
var _Function = require("../../Function.js");
var _Predicate = require("../../Predicate.js");
var OpCodes = _interopRequireWildcard(require("../opCodes/channelUpstreamPullRequest.js"));
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function (e) { return e ? t : r; })(e); }
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != typeof e && "function" != typeof e) return { default: e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && {}.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n.default = e, t && t.set(e, n), n; }
/** @internal */
const UpstreamPullRequestSymbolKey = "effect/ChannelUpstreamPullRequest";
/** @internal */
const UpstreamPullRequestTypeId = exports.UpstreamPullRequestTypeId = /*#__PURE__*/Symbol.for(UpstreamPullRequestSymbolKey);
const upstreamPullRequestVariance = {
/* c8 ignore next */
_A: _ => _
};
/** @internal */
const proto = {
[UpstreamPullRequestTypeId]: upstreamPullRequestVariance
};
/** @internal */
const Pulled = value => {
const op = Object.create(proto);
op._tag = OpCodes.OP_PULLED;
op.value = value;
return op;
};
/** @internal */
exports.Pulled = Pulled;
const NoUpstream = activeDownstreamCount => {
const op = Object.create(proto);
op._tag = OpCodes.OP_NO_UPSTREAM;
op.activeDownstreamCount = activeDownstreamCount;
return op;
};
/** @internal */
exports.NoUpstream = NoUpstream;
const isUpstreamPullRequest = u => (0, _Predicate.hasProperty)(u, UpstreamPullRequestTypeId);
/** @internal */
exports.isUpstreamPullRequest = isUpstreamPullRequest;
const isPulled = self => self._tag === OpCodes.OP_PULLED;
/** @internal */
exports.isPulled = isPulled;
const isNoUpstream = self => self._tag === OpCodes.OP_NO_UPSTREAM;
/** @internal */
exports.isNoUpstream = isNoUpstream;
const match = exports.match = /*#__PURE__*/(0, _Function.dual)(2, (self, {
onNoUpstream,
onPulled
}) => {
switch (self._tag) {
case OpCodes.OP_PULLED:
{
return onPulled(self.value);
}
case OpCodes.OP_NO_UPSTREAM:
{
return onNoUpstream(self.activeDownstreamCount);
}
}
});
//# sourceMappingURL=upstreamPullRequest.js.map