_xfindLast.js 659 B

1234567891011121314151617181920212223242526272829303132
  1. import _xfBase from "./_xfBase.js";
  2. var XFindLast =
  3. /*#__PURE__*/
  4. function () {
  5. function XFindLast(f, xf) {
  6. this.xf = xf;
  7. this.f = f;
  8. }
  9. XFindLast.prototype['@@transducer/init'] = _xfBase.init;
  10. XFindLast.prototype['@@transducer/result'] = function (result) {
  11. return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.last));
  12. };
  13. XFindLast.prototype['@@transducer/step'] = function (result, input) {
  14. if (this.f(input)) {
  15. this.last = input;
  16. }
  17. return result;
  18. };
  19. return XFindLast;
  20. }();
  21. export default function _xfindLast(f) {
  22. return function (xf) {
  23. return new XFindLast(f, xf);
  24. };
  25. }