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