source: node_modules/ramda/src/internal/_xtake.js

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: 715 bytes
Line 
1var _reduced =
2/*#__PURE__*/
3require("./_reduced.js");
4
5var _xfBase =
6/*#__PURE__*/
7require("./_xfBase.js");
8
9var XTake =
10/*#__PURE__*/
11function () {
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
30function _xtake(n) {
31 return function (xf) {
32 return new XTake(n, xf);
33 };
34}
35
36module.exports = _xtake;
Note: See TracBrowser for help on using the repository browser.