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:
617 bytes
|
Rev | Line | |
---|
[d24f17c] | 1 | import _Set from "./_Set.js";
|
---|
| 2 | import _xfBase from "./_xfBase.js";
|
---|
| 3 |
|
---|
| 4 | var XUniqBy =
|
---|
| 5 | /*#__PURE__*/
|
---|
| 6 | function () {
|
---|
| 7 | function XUniqBy(f, xf) {
|
---|
| 8 | this.xf = xf;
|
---|
| 9 | this.f = f;
|
---|
| 10 | this.set = new _Set();
|
---|
| 11 | }
|
---|
| 12 |
|
---|
| 13 | XUniqBy.prototype['@@transducer/init'] = _xfBase.init;
|
---|
| 14 | XUniqBy.prototype['@@transducer/result'] = _xfBase.result;
|
---|
| 15 |
|
---|
| 16 | XUniqBy.prototype['@@transducer/step'] = function (result, input) {
|
---|
| 17 | return this.set.add(this.f(input)) ? this.xf['@@transducer/step'](result, input) : result;
|
---|
| 18 | };
|
---|
| 19 |
|
---|
| 20 | return XUniqBy;
|
---|
| 21 | }();
|
---|
| 22 |
|
---|
| 23 | export default function _xuniqBy(f) {
|
---|
| 24 | return function (xf) {
|
---|
| 25 | return new XUniqBy(f, xf);
|
---|
| 26 | };
|
---|
| 27 | } |
---|
Note:
See
TracBrowser
for help on using the repository browser.