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