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