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