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:
770 bytes
|
Line | |
---|
1 | import _xfBase from "./_xfBase.js";
|
---|
2 |
|
---|
3 | var XFindLastIndex =
|
---|
4 | /*#__PURE__*/
|
---|
5 | function () {
|
---|
6 | function XFindLastIndex(f, xf) {
|
---|
7 | this.xf = xf;
|
---|
8 | this.f = f;
|
---|
9 | this.idx = -1;
|
---|
10 | this.lastIdx = -1;
|
---|
11 | }
|
---|
12 |
|
---|
13 | XFindLastIndex.prototype['@@transducer/init'] = _xfBase.init;
|
---|
14 |
|
---|
15 | XFindLastIndex.prototype['@@transducer/result'] = function (result) {
|
---|
16 | return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.lastIdx));
|
---|
17 | };
|
---|
18 |
|
---|
19 | XFindLastIndex.prototype['@@transducer/step'] = function (result, input) {
|
---|
20 | this.idx += 1;
|
---|
21 |
|
---|
22 | if (this.f(input)) {
|
---|
23 | this.lastIdx = this.idx;
|
---|
24 | }
|
---|
25 |
|
---|
26 | return result;
|
---|
27 | };
|
---|
28 |
|
---|
29 | return XFindLastIndex;
|
---|
30 | }();
|
---|
31 |
|
---|
32 | export default function _xfindLastIndex(f) {
|
---|
33 | return function (xf) {
|
---|
34 | return new XFindLastIndex(f, xf);
|
---|
35 | };
|
---|
36 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.