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.1 KB
|
Rev | Line | |
---|
[d24f17c] | 1 | var _xfBase =
|
---|
| 2 | /*#__PURE__*/
|
---|
| 3 | require("./_xfBase.js");
|
---|
| 4 |
|
---|
| 5 | var _xReduce =
|
---|
| 6 | /*#__PURE__*/
|
---|
| 7 | require("./_xReduce.js");
|
---|
| 8 |
|
---|
| 9 | var XDropLastWhile =
|
---|
| 10 | /*#__PURE__*/
|
---|
| 11 | function () {
|
---|
| 12 | function XDropLastWhile(fn, xf) {
|
---|
| 13 | this.f = fn;
|
---|
| 14 | this.retained = [];
|
---|
| 15 | this.xf = xf;
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | XDropLastWhile.prototype['@@transducer/init'] = _xfBase.init;
|
---|
| 19 |
|
---|
| 20 | XDropLastWhile.prototype['@@transducer/result'] = function (result) {
|
---|
| 21 | this.retained = null;
|
---|
| 22 | return this.xf['@@transducer/result'](result);
|
---|
| 23 | };
|
---|
| 24 |
|
---|
| 25 | XDropLastWhile.prototype['@@transducer/step'] = function (result, input) {
|
---|
| 26 | return this.f(input) ? this.retain(result, input) : this.flush(result, input);
|
---|
| 27 | };
|
---|
| 28 |
|
---|
| 29 | XDropLastWhile.prototype.flush = function (result, input) {
|
---|
| 30 | result = _xReduce(this.xf, result, this.retained);
|
---|
| 31 | this.retained = [];
|
---|
| 32 | return this.xf['@@transducer/step'](result, input);
|
---|
| 33 | };
|
---|
| 34 |
|
---|
| 35 | XDropLastWhile.prototype.retain = function (result, input) {
|
---|
| 36 | this.retained.push(input);
|
---|
| 37 | return result;
|
---|
| 38 | };
|
---|
| 39 |
|
---|
| 40 | return XDropLastWhile;
|
---|
| 41 | }();
|
---|
| 42 |
|
---|
| 43 | function _xdropLastWhile(fn) {
|
---|
| 44 | return function (xf) {
|
---|
| 45 | return new XDropLastWhile(fn, xf);
|
---|
| 46 | };
|
---|
| 47 | }
|
---|
| 48 |
|
---|
| 49 | module.exports = _xdropLastWhile; |
---|
Note:
See
TracBrowser
for help on using the repository browser.