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:
1.2 KB
|
Line | |
---|
1 | import _forceReduced from "./_forceReduced.js";
|
---|
2 | import _isArrayLike from "./_isArrayLike.js";
|
---|
3 | import _xArrayReduce from "./_xArrayReduce.js";
|
---|
4 | import _xReduce from "./_xReduce.js";
|
---|
5 | import _xfBase from "./_xfBase.js";
|
---|
6 | var tInit = '@@transducer/init';
|
---|
7 | var tStep = '@@transducer/step';
|
---|
8 | var tResult = '@@transducer/result';
|
---|
9 |
|
---|
10 | var XPreservingReduced =
|
---|
11 | /*#__PURE__*/
|
---|
12 | function () {
|
---|
13 | function XPreservingReduced(xf) {
|
---|
14 | this.xf = xf;
|
---|
15 | }
|
---|
16 |
|
---|
17 | XPreservingReduced.prototype[tInit] = _xfBase.init;
|
---|
18 | XPreservingReduced.prototype[tResult] = _xfBase.result;
|
---|
19 |
|
---|
20 | XPreservingReduced.prototype[tStep] = function (result, input) {
|
---|
21 | var ret = this.xf[tStep](result, input);
|
---|
22 | return ret['@@transducer/reduced'] ? _forceReduced(ret) : ret;
|
---|
23 | };
|
---|
24 |
|
---|
25 | return XPreservingReduced;
|
---|
26 | }();
|
---|
27 |
|
---|
28 | var XFlatCat =
|
---|
29 | /*#__PURE__*/
|
---|
30 | function () {
|
---|
31 | function XFlatCat(xf) {
|
---|
32 | this.xf = new XPreservingReduced(xf);
|
---|
33 | }
|
---|
34 |
|
---|
35 | XFlatCat.prototype[tInit] = _xfBase.init;
|
---|
36 | XFlatCat.prototype[tResult] = _xfBase.result;
|
---|
37 |
|
---|
38 | XFlatCat.prototype[tStep] = function (result, input) {
|
---|
39 | return !_isArrayLike(input) ? _xArrayReduce(this.xf, result, [input]) : _xReduce(this.xf, result, input);
|
---|
40 | };
|
---|
41 |
|
---|
42 | return XFlatCat;
|
---|
43 | }();
|
---|
44 |
|
---|
45 | var _flatCat = function _xcat(xf) {
|
---|
46 | return new XFlatCat(xf);
|
---|
47 | };
|
---|
48 |
|
---|
49 | export default _flatCat; |
---|
Note:
See
TracBrowser
for help on using the repository browser.