_xall.js 793 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. import _reduced from "./_reduced.js";
  2. import _xfBase from "./_xfBase.js";
  3. var XAll =
  4. /*#__PURE__*/
  5. function () {
  6. function XAll(f, xf) {
  7. this.xf = xf;
  8. this.f = f;
  9. this.all = true;
  10. }
  11. XAll.prototype['@@transducer/init'] = _xfBase.init;
  12. XAll.prototype['@@transducer/result'] = function (result) {
  13. if (this.all) {
  14. result = this.xf['@@transducer/step'](result, true);
  15. }
  16. return this.xf['@@transducer/result'](result);
  17. };
  18. XAll.prototype['@@transducer/step'] = function (result, input) {
  19. if (!this.f(input)) {
  20. this.all = false;
  21. result = _reduced(this.xf['@@transducer/step'](result, false));
  22. }
  23. return result;
  24. };
  25. return XAll;
  26. }();
  27. export default function _xall(f) {
  28. return function (xf) {
  29. return new XAll(f, xf);
  30. };
  31. }