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