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
|
Line | |
---|
1 | var _includesWith =
|
---|
2 | /*#__PURE__*/
|
---|
3 | require("./_includesWith.js");
|
---|
4 |
|
---|
5 | var _xfBase =
|
---|
6 | /*#__PURE__*/
|
---|
7 | require("./_xfBase.js");
|
---|
8 |
|
---|
9 | var XUniqWith =
|
---|
10 | /*#__PURE__*/
|
---|
11 | function () {
|
---|
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 |
|
---|
33 | function _xuniqWith(pred) {
|
---|
34 | return function (xf) {
|
---|
35 | return new XUniqWith(pred, xf);
|
---|
36 | };
|
---|
37 | }
|
---|
38 |
|
---|
39 | module.exports = _xuniqWith; |
---|
Note:
See
TracBrowser
for help on using the repository browser.