source: node_modules/ramda/src/internal/_flatCat.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.3 KB
Line 
1var _forceReduced =
2/*#__PURE__*/
3require("./_forceReduced.js");
4
5var _isArrayLike =
6/*#__PURE__*/
7require("./_isArrayLike.js");
8
9var _xArrayReduce =
10/*#__PURE__*/
11require("./_xArrayReduce.js");
12
13var _xReduce =
14/*#__PURE__*/
15require("./_xReduce.js");
16
17var _xfBase =
18/*#__PURE__*/
19require("./_xfBase.js");
20
21var tInit = '@@transducer/init';
22var tStep = '@@transducer/step';
23var tResult = '@@transducer/result';
24
25var XPreservingReduced =
26/*#__PURE__*/
27function () {
28 function XPreservingReduced(xf) {
29 this.xf = xf;
30 }
31
32 XPreservingReduced.prototype[tInit] = _xfBase.init;
33 XPreservingReduced.prototype[tResult] = _xfBase.result;
34
35 XPreservingReduced.prototype[tStep] = function (result, input) {
36 var ret = this.xf[tStep](result, input);
37 return ret['@@transducer/reduced'] ? _forceReduced(ret) : ret;
38 };
39
40 return XPreservingReduced;
41}();
42
43var XFlatCat =
44/*#__PURE__*/
45function () {
46 function XFlatCat(xf) {
47 this.xf = new XPreservingReduced(xf);
48 }
49
50 XFlatCat.prototype[tInit] = _xfBase.init;
51 XFlatCat.prototype[tResult] = _xfBase.result;
52
53 XFlatCat.prototype[tStep] = function (result, input) {
54 return !_isArrayLike(input) ? _xArrayReduce(this.xf, result, [input]) : _xReduce(this.xf, result, input);
55 };
56
57 return XFlatCat;
58}();
59
60var _flatCat = function _xcat(xf) {
61 return new XFlatCat(xf);
62};
63
64module.exports = _flatCat;
Note: See TracBrowser for help on using the repository browser.