UNPKG

769 BJavaScriptView Raw
1var _curry2 =
2/*#__PURE__*/
3require("./_curry2");
4
5var _reduced =
6/*#__PURE__*/
7require("./_reduced");
8
9var _xfBase =
10/*#__PURE__*/
11require("./_xfBase");
12
13var XTake =
14/*#__PURE__*/
15function () {
16 function XTake(n, xf) {
17 this.xf = xf;
18 this.n = n;
19 this.i = 0;
20 }
21
22 XTake.prototype['@@transducer/init'] = _xfBase.init;
23 XTake.prototype['@@transducer/result'] = _xfBase.result;
24
25 XTake.prototype['@@transducer/step'] = function (result, input) {
26 this.i += 1;
27 var ret = this.n === 0 ? result : this.xf['@@transducer/step'](result, input);
28 return this.n >= 0 && this.i >= this.n ? _reduced(ret) : ret;
29 };
30
31 return XTake;
32}();
33
34var _xtake =
35/*#__PURE__*/
36_curry2(function _xtake(n, xf) {
37 return new XTake(n, xf);
38});
39
40module.exports = _xtake;
\No newline at end of file