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