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