1 | var _curry2 =
|
2 |
|
3 | require("./_curry2");
|
4 |
|
5 | var _reduced =
|
6 |
|
7 | require("./_reduced");
|
8 |
|
9 | var _xfBase =
|
10 |
|
11 | require("./_xfBase");
|
12 |
|
13 | var XTake =
|
14 |
|
15 | function () {
|
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 |
|
34 | var _xtake =
|
35 |
|
36 | _curry2(function _xtake(n, xf) {
|
37 | return new XTake(n, xf);
|
38 | });
|
39 |
|
40 | module.exports = _xtake; |
\ | No newline at end of file |