UNPKG

veffect

Version:

powerful TypeScript validation library built on the robust foundation of Effect combining exceptional type safety, high performance, and developer experience. Taking inspiration from Effect's functional principles, VEffect delivers a balanced approach tha

99 lines (98 loc) 2.73 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.match = exports.isRight = exports.isLeft = exports.isEither = exports.isBoth = exports.fromInput = exports.Right = exports.Left = exports.Either = exports.Both = void 0; var _Function = /*#__PURE__*/require("../../Function.js"); var OpCodes = /*#__PURE__*/_interopRequireWildcard( /*#__PURE__*/require("../opCodes/streamHaltStrategy.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 Left = exports.Left = { _tag: OpCodes.OP_LEFT }; /** @internal */ const Right = exports.Right = { _tag: OpCodes.OP_RIGHT }; /** @internal */ const Both = exports.Both = { _tag: OpCodes.OP_BOTH }; /** @internal */ const Either = exports.Either = { _tag: OpCodes.OP_EITHER }; /** @internal */ const fromInput = input => { switch (input) { case "left": return Left; case "right": return Right; case "both": return Both; case "either": return Either; default: return input; } }; /** @internal */ exports.fromInput = fromInput; const isLeft = self => self._tag === OpCodes.OP_LEFT; /** @internal */ exports.isLeft = isLeft; const isRight = self => self._tag === OpCodes.OP_RIGHT; /** @internal */ exports.isRight = isRight; const isBoth = self => self._tag === OpCodes.OP_BOTH; /** @internal */ exports.isBoth = isBoth; const isEither = self => self._tag === OpCodes.OP_EITHER; /** @internal */ exports.isEither = isEither; const match = exports.match = /*#__PURE__*/(0, _Function.dual)(5, (self, onLeft, onRight, onBoth, onEither) => { switch (self._tag) { case OpCodes.OP_LEFT: { return onLeft(); } case OpCodes.OP_RIGHT: { return onRight(); } case OpCodes.OP_BOTH: { return onBoth(); } case OpCodes.OP_EITHER: { return onEither(); } } }); //# sourceMappingURL=haltStrategy.js.map