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:
748 bytes
|
Line | |
---|
1 | import _includesWith from "./_includesWith.js";
|
---|
2 | import _xfBase from "./_xfBase.js";
|
---|
3 |
|
---|
4 | var XUniqWith =
|
---|
5 | /*#__PURE__*/
|
---|
6 | function () {
|
---|
7 | function XUniqWith(pred, xf) {
|
---|
8 | this.xf = xf;
|
---|
9 | this.pred = pred;
|
---|
10 | this.items = [];
|
---|
11 | }
|
---|
12 |
|
---|
13 | XUniqWith.prototype['@@transducer/init'] = _xfBase.init;
|
---|
14 | XUniqWith.prototype['@@transducer/result'] = _xfBase.result;
|
---|
15 |
|
---|
16 | XUniqWith.prototype['@@transducer/step'] = function (result, input) {
|
---|
17 | if (_includesWith(this.pred, input, this.items)) {
|
---|
18 | return result;
|
---|
19 | } else {
|
---|
20 | this.items.push(input);
|
---|
21 | return this.xf['@@transducer/step'](result, input);
|
---|
22 | }
|
---|
23 | };
|
---|
24 |
|
---|
25 | return XUniqWith;
|
---|
26 | }();
|
---|
27 |
|
---|
28 | export default function _xuniqWith(pred) {
|
---|
29 | return function (xf) {
|
---|
30 | return new XUniqWith(pred, xf);
|
---|
31 | };
|
---|
32 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.