main
Last change
on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
773 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | var _createReduce =
|
---|
| 2 | /*#__PURE__*/
|
---|
| 3 | require("./_createReduce.js");
|
---|
| 4 |
|
---|
| 5 | var _xArrayReduce =
|
---|
| 6 | /*#__PURE__*/
|
---|
| 7 | require("./_xArrayReduce.js");
|
---|
| 8 |
|
---|
| 9 | var bind =
|
---|
| 10 | /*#__PURE__*/
|
---|
| 11 | require("../bind.js");
|
---|
| 12 |
|
---|
| 13 | function _xIterableReduce(xf, acc, iter) {
|
---|
| 14 | var step = iter.next();
|
---|
| 15 |
|
---|
| 16 | while (!step.done) {
|
---|
| 17 | acc = xf['@@transducer/step'](acc, step.value);
|
---|
| 18 |
|
---|
| 19 | if (acc && acc['@@transducer/reduced']) {
|
---|
| 20 | acc = acc['@@transducer/value'];
|
---|
| 21 | break;
|
---|
| 22 | }
|
---|
| 23 |
|
---|
| 24 | step = iter.next();
|
---|
| 25 | }
|
---|
| 26 |
|
---|
| 27 | return xf['@@transducer/result'](acc);
|
---|
| 28 | }
|
---|
| 29 |
|
---|
| 30 | function _xMethodReduce(xf, acc, obj, methodName) {
|
---|
| 31 | return xf['@@transducer/result'](obj[methodName](bind(xf['@@transducer/step'], xf), acc));
|
---|
| 32 | }
|
---|
| 33 |
|
---|
| 34 | var _xReduce =
|
---|
| 35 | /*#__PURE__*/
|
---|
| 36 | _createReduce(_xArrayReduce, _xMethodReduce, _xIterableReduce);
|
---|
| 37 |
|
---|
| 38 | module.exports = _xReduce; |
---|
Note:
See
TracBrowser
for help on using the repository browser.