source: node_modules/ramda/es/internal/_xfind.js

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