source: node_modules/ramda/src/internal/_xuniqWith.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: 798 bytes
RevLine 
[d24f17c]1var _includesWith =
2/*#__PURE__*/
3require("./_includesWith.js");
4
5var _xfBase =
6/*#__PURE__*/
7require("./_xfBase.js");
8
9var XUniqWith =
10/*#__PURE__*/
11function () {
12 function XUniqWith(pred, xf) {
13 this.xf = xf;
14 this.pred = pred;
15 this.items = [];
16 }
17
18 XUniqWith.prototype['@@transducer/init'] = _xfBase.init;
19 XUniqWith.prototype['@@transducer/result'] = _xfBase.result;
20
21 XUniqWith.prototype['@@transducer/step'] = function (result, input) {
22 if (_includesWith(this.pred, input, this.items)) {
23 return result;
24 } else {
25 this.items.push(input);
26 return this.xf['@@transducer/step'](result, input);
27 }
28 };
29
30 return XUniqWith;
31}();
32
33function _xuniqWith(pred) {
34 return function (xf) {
35 return new XUniqWith(pred, xf);
36 };
37}
38
39module.exports = _xuniqWith;
Note: See TracBrowser for help on using the repository browser.