main
Last change
on this file since 65b6638 was d24f17c, checked in by Aleksandar Panovski <apano77@…>, 15 months ago |
Initial commit
|
-
Property mode
set to
100644
|
File size:
715 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | var _reduced =
|
---|
| 2 | /*#__PURE__*/
|
---|
| 3 | require("./_reduced.js");
|
---|
| 4 |
|
---|
| 5 | var _xfBase =
|
---|
| 6 | /*#__PURE__*/
|
---|
| 7 | require("./_xfBase.js");
|
---|
| 8 |
|
---|
| 9 | var XTake =
|
---|
| 10 | /*#__PURE__*/
|
---|
| 11 | function () {
|
---|
| 12 | function XTake(n, xf) {
|
---|
| 13 | this.xf = xf;
|
---|
| 14 | this.n = n;
|
---|
| 15 | this.i = 0;
|
---|
| 16 | }
|
---|
| 17 |
|
---|
| 18 | XTake.prototype['@@transducer/init'] = _xfBase.init;
|
---|
| 19 | XTake.prototype['@@transducer/result'] = _xfBase.result;
|
---|
| 20 |
|
---|
| 21 | XTake.prototype['@@transducer/step'] = function (result, input) {
|
---|
| 22 | this.i += 1;
|
---|
| 23 | var ret = this.n === 0 ? result : this.xf['@@transducer/step'](result, input);
|
---|
| 24 | return this.n >= 0 && this.i >= this.n ? _reduced(ret) : ret;
|
---|
| 25 | };
|
---|
| 26 |
|
---|
| 27 | return XTake;
|
---|
| 28 | }();
|
---|
| 29 |
|
---|
| 30 | function _xtake(n) {
|
---|
| 31 | return function (xf) {
|
---|
| 32 | return new XTake(n, xf);
|
---|
| 33 | };
|
---|
| 34 | }
|
---|
| 35 |
|
---|
| 36 | module.exports = _xtake; |
---|
Note:
See
TracBrowser
for help on using the repository browser.