server-json/node_modules/ramda/es/internal/_xfindLastIndex.js
2024-11-01 08:00:42 +00:00

26 lines
No EOL
761 B
JavaScript

import _xfBase from "./_xfBase.js";
var XFindLastIndex = /*#__PURE__*/function () {
function XFindLastIndex(f, xf) {
this.xf = xf;
this.f = f;
this.idx = -1;
this.lastIdx = -1;
}
XFindLastIndex.prototype['@@transducer/init'] = _xfBase.init;
XFindLastIndex.prototype['@@transducer/result'] = function (result) {
return this.xf['@@transducer/result'](this.xf['@@transducer/step'](result, this.lastIdx));
};
XFindLastIndex.prototype['@@transducer/step'] = function (result, input) {
this.idx += 1;
if (this.f(input)) {
this.lastIdx = this.idx;
}
return result;
};
return XFindLastIndex;
}();
export default function _xfindLastIndex(f) {
return function (xf) {
return new XFindLastIndex(f, xf);
};
}