source: node_modules/ramda/src/internal/_xdropLastWhile.js@ d24f17c

main
Last change on this file since d24f17c was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago

Initial commit

  • Property mode set to 100644
File size: 1.1 KB
Line 
1var _xfBase =
2/*#__PURE__*/
3require("./_xfBase.js");
4
5var _xReduce =
6/*#__PURE__*/
7require("./_xReduce.js");
8
9var XDropLastWhile =
10/*#__PURE__*/
11function () {
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
43function _xdropLastWhile(fn) {
44 return function (xf) {
45 return new XDropLastWhile(fn, xf);
46 };
47}
48
49module.exports = _xdropLastWhile;
Note: See TracBrowser for help on using the repository browser.