main
Last change
on this file was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
659 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import _xfBase from "./_xfBase.js";
|
---|
| 2 |
|
---|
| 3 | var XFindLast =
|
---|
| 4 | /*#__PURE__*/
|
---|
| 5 | function () {
|
---|
| 6 | function XFindLast(f, xf) {
|
---|
| 7 | this.xf = xf;
|
---|
| 8 | this.f = f;
|
---|
| 9 | }
|
---|
| 10 |
|
---|
| 11 | XFindLast.prototype['@@transducer/init'] = _xfBase.init;
|
---|
| 12 |
|
---|
| 13 | XFindLast.prototype['@@transducer/result'] = function (result) {
|
---|
| 14 | return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.last));
|
---|
| 15 | };
|
---|
| 16 |
|
---|
| 17 | XFindLast.prototype['@@transducer/step'] = function (result, input) {
|
---|
| 18 | if (this.f(input)) {
|
---|
| 19 | this.last = input;
|
---|
| 20 | }
|
---|
| 21 |
|
---|
| 22 | return result;
|
---|
| 23 | };
|
---|
| 24 |
|
---|
| 25 | return XFindLast;
|
---|
| 26 | }();
|
---|
| 27 |
|
---|
| 28 | export default function _xfindLast(f) {
|
---|
| 29 | return function (xf) {
|
---|
| 30 | return new XFindLast(f, xf);
|
---|
| 31 | };
|
---|
| 32 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.