版博士V2.0程序
Nelze vybrat více než 25 témat Téma musí začínat písmenem nebo číslem, může obsahovat pomlčky („-“) a může být dlouhé až 35 znaků.
 
 
 
 

49 řádky
1.9 KiB

  1. "use strict";
  2. var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
  3. if (k2 === undefined) k2 = k;
  4. var desc = Object.getOwnPropertyDescriptor(m, k);
  5. if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
  6. desc = { enumerable: true, get: function() { return m[k]; } };
  7. }
  8. Object.defineProperty(o, k2, desc);
  9. }) : (function(o, m, k, k2) {
  10. if (k2 === undefined) k2 = k;
  11. o[k2] = m[k];
  12. }));
  13. var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
  14. Object.defineProperty(o, "default", { enumerable: true, value: v });
  15. }) : function(o, v) {
  16. o["default"] = v;
  17. });
  18. var __importStar = (this && this.__importStar) || function (mod) {
  19. if (mod && mod.__esModule) return mod;
  20. var result = {};
  21. if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
  22. __setModuleDefault(result, mod);
  23. return result;
  24. };
  25. Object.defineProperty(exports, "__esModule", { value: true });
  26. exports.getValidationM = void 0;
  27. /**
  28. * @since 2.0.0
  29. */
  30. var Applicative_1 = require("./Applicative");
  31. var E = __importStar(require("./Either"));
  32. var _ = __importStar(require("./internal"));
  33. /** @deprecated */
  34. function getValidationM(S, M) {
  35. var A = (0, Applicative_1.getApplicativeComposition)(M, E.getApplicativeValidation(S));
  36. return {
  37. map: A.map,
  38. ap: A.ap,
  39. of: A.of,
  40. chain: function (ma, f) { return M.chain(ma, function (e) { return (_.isLeft(e) ? M.of(_.left(e.left)) : f(e.right)); }); },
  41. alt: function (me, that) {
  42. return M.chain(me, function (e1) {
  43. return _.isRight(e1) ? M.of(e1) : M.map(that(), function (e2) { return (_.isLeft(e2) ? _.left(S.concat(e1.left, e2.left)) : e2); });
  44. });
  45. }
  46. };
  47. }
  48. exports.getValidationM = getValidationM;