Nothing Special   »   [go: up one dir, main page]

1.0.3 • Published 2 years ago

rxjs-drop-intermediate v1.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

rxjs-drop-intermediate

CircleCI codecov

RxJS operator to prevent congestion by dropping intermediate values. This can be useful when there are many events generated by user-input or a WebSocket connection where some intermediate events (e.g. updates from a certain channel) can be dropped.

Usage:

import { dropIntermediate } from 'rxjs-drop-intermediate';

const droppingObservable = source.pipe(dropIntermediate());

Example taken from integration tests:

const subject = new Subject<string>();
webSocket. => subject.next(m.data.toLocaleString());
const actual = await firstValueFrom(
  subject.pipe(
    dropIntermediate(),
    map((v) => parseInt(v)),
    tap(() => execSync('sleep 2')),
    take(2),
    toArray(),
    map((a) => a[1] - a[0])
  )
);

expect(actual).toBeGreaterThan(5);
1.0.3

2 years ago

1.0.2

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago