aboutsummaryrefslogtreecommitdiffstats
path: root/node_modules/rxjs/dist/esm/internal/operators/distinct.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/rxjs/dist/esm/internal/operators/distinct.js')
-rw-r--r--node_modules/rxjs/dist/esm/internal/operators/distinct.js18
1 files changed, 18 insertions, 0 deletions
diff --git a/node_modules/rxjs/dist/esm/internal/operators/distinct.js b/node_modules/rxjs/dist/esm/internal/operators/distinct.js
new file mode 100644
index 0000000..597a805
--- /dev/null
+++ b/node_modules/rxjs/dist/esm/internal/operators/distinct.js
@@ -0,0 +1,18 @@
+import { operate } from '../util/lift';
+import { createOperatorSubscriber } from './OperatorSubscriber';
+import { noop } from '../util/noop';
+import { innerFrom } from '../observable/innerFrom';
+export function distinct(keySelector, flushes) {
+ return operate((source, subscriber) => {
+ const distinctKeys = new Set();
+ source.subscribe(createOperatorSubscriber(subscriber, (value) => {
+ const key = keySelector ? keySelector(value) : value;
+ if (!distinctKeys.has(key)) {
+ distinctKeys.add(key);
+ subscriber.next(value);
+ }
+ }));
+ flushes && innerFrom(flushes).subscribe(createOperatorSubscriber(subscriber, () => distinctKeys.clear(), noop));
+ });
+}
+//# sourceMappingURL=distinct.js.map \ No newline at end of file
send patches to the email below
yukais@pinapelz.com
include the subject [PATCH repo_name]
pinapelz.com
homepage