Important: This documentation covers Yarn 1 (Classic).
For Yarn 2+ docs and migration guide, see yarnpkg.com.

Package detail

rxjs-etc

cartant105.9kMIT10.6.2TypeScript support: included

Observables and operators for RxJS

observable, rxjs

readme

rxjs-etc

GitHub License NPM version Build status dependency status devDependency Status peerDependency Status

What is it?

A bunch of observables and operators for RxJS.

Why might you need it?

I created this package as a place to put additional RxJS observables, operators and methods. If you are looking for something that's not in the RxJS distribution, there might be something suitable in here - if you're lucky.

Install

Install the package using NPM:

npm install rxjs-etc --save

What's in it?

Observable factories

  • combineLatestArray, concatArray, forkJoinArray, mergeArray, zipArray

    A bunch of static methods that behave in a predictable manner when passed empty arrays. Some of these are now redundant, but some aren't.

    To see how these methods behave, consult their tests.

  • combineLatestHigherOrderArray, combineLatestHigherOrderObject

    Higher-order variants of combineLatestArray - that takes Observable<Observable<T>[]> and returns Observable<T[]> - and combineLatestObject.

  • combineLatestObject, forkJoinObject, zipObject

    Like the array versions, but these take objects. Observable properties are combined using either combineLatest, forkJoin or zip.

  • forkJoinConcurrent

    Like forkJoin but only runs the specified number of observables concurrently.

  • mergeHigherOrderArray

    Higher-order variant of mergeArray - that takes Observable<Observable<T>[]> and returns Observable<T>.

  • toggle

    Splits a notifier into two or more states and between which notifications are toggled.

  • traverse

    Based on expand. Traverses a graph - with backpressure control - using either a notifier or a consumer.

  • zipPadded

    Works like zipArray, but if some sources complete whilst others continue to emit values, those the complete are 'padded' with the specified padValue (which defaults to undefined).

  • percolate

    Runs a sequence of observables in order until an observable completes successfully.

Functions for use with pipe or let

A bunch of functions that can be passed to the let operator. Use them like this:

source.let(endWith("this is the end"))

They can also be used with pipe, like this:

source.pipe(endWith("this is the end"))
  • bucketBy

    Uses a hash function to put values from an observable stream into buckets - which are themselves observable streams. See splitBy.

  • bufferRecent

    Buffers the specified number of most-recent values.

  • concatIfEmpty

    Like defaultIfEmpty, but it takes a default observable instead of a default value.

  • concatMapEager

    Like the RxJava concatMapEager operator. It accepts a concurrency and eagerly subscribes to its inner observables, buffering their values and then emitting them in the concatMap order.

  • continueWith

    Mirrors the source, but sends the last received value to a project function and merges the ObservableInput that it returns.

  • debounceAfter

    Debounce the source observable, but only after the notifier emits a value.

  • debounceSync

    Debounces synchronously emitted values from a source.

  • debounceTimeSubsequent

    Debounce the source observable, but don't debounce the first count notifications - only the subsequent notifications.

  • debounceTimeWithinReason

    Like debounceTime, but with an additional duration to ensure some notifications are emitted for super-busy streams.

  • delayUntil

    Delays a source's value notifications until a signal is received from a notifier.

  • dispose

    Like finalize, but calls a child subscription's callback for its parent's.

  • endWith

    Like startWith, but for the other end.

  • equals

    Like filter, but takes a value - rather than a function - and performs a reference equality check.

  • guard

    Applies the specified TypeScript guard to change the source observable's type and perform a runtime check. Emits an error notification if the guard rejects a value.

  • hasCompleted

    Emits true when the source observable completes.

  • indexElements

    Like map((value, index) => index) when it's called without a selector. When called with a selector, it's just an alias for map.

  • inexorably

    Like finalize (which is also exported as an alias), but passes the callback the Notification that effected the teardown, or undefined if explicitly unsubscribed.

  • initial

    Apply the operator to the source observable, but select only the initial count notifications - don't select the subsequent notifications.

  • pairwiseStartWith

    Like a combination of startWith and pairwise, but with more specific typings.

  • pluck

    Like pluck, but it's type-safe and only lets you valid keys. And it returns the appropriate type.

  • prioritize

    When creating signals from a source observable - for use with operators that take a notifier, like buffer and window - the order in which subscriptions are made is important. prioritize can be used to ensure that the notifier subscribes to the source first.

  • rateLimit

    A rate limiter with pass through when waiting is not necessary.

  • refCountDelay

    Can be used with a ConnectableObservable instead of refCount. When the reference count drops to zero, it waits the specified duration and then if the reference count is zero, it unsubscribes. If the reference count is incremented within the duration, no unsubscription occurs.

  • refCountForever

    Somewhat like the change that was made to shareReplay in 5.5.0.beta.4. When first subscribed to, a subscription is made to the source, but the source is never explicitly unsubscribed from. Unsubscription from the source only occurs if the source completes or errors.

  • refCountOn

    Like refCount, but performs connections and unsubscriptions on the specified scheduler.

  • reschedule

    Emits values using the specified scheduler.

  • skipSync

    Skips the initial, synchronously emitted values from a source.

  • splitBy

    Splits an observable stream into two streams. Values that satisfy a predicate are fed into the first stream and values that don't are fed into the second. It's a (better) replacement for partition - which did not multicast the source. See bucketBy for the general case of splitting a stream into a specific number of 'buckets'.

  • startWithTimeout

    Like startWith but only emits the starting value if the source does not emit within the specified duration.

  • subsequent

    Apply the operator to the source observable, but don't select the first count notifications - only the subsequent notifications.

  • takeSync

    Takes the initial, synchronously emitted values from a source and then completes.

  • takeWhileInclusive

    Like takeWhile, but the value that fails the predicate is taken.

  • tapSubscribe

    Like tap, but for subscriptions and unsubscriptions instead of notifications.

  • tapWithIndex

    Like tap, but it receives a tuple that includes the emitted value and the index.

  • throttleAfter

    Throttle the source observable, but only after the notifier emits a value.

  • unsubscribeOn

    Like subscribeOn, but for unsubscription.

Utility functions

A bunch of utility functions that do what their names suggest:

changelog

10.6.2 (2022-01-15)

Changes

  • Remove the rxjs-report-usage dependency. (6ba4141).

10.6.1 (2021-05-29)

Changes

  • Widen peer range to include RxJS version 7. (2e9465e).

10.6.0 (2021-04-18)

Features

  • Add the continueWith operator. (bf71a05).

10.5.2 (2021-01-17)

Fixes

  • Export the percolate operator. (64c8560).

10.5.1 (2020-11-28)

Changes

  • Use files in package.json instead of .npmignore. (2dd8e91).

10.5.0 (2020-11-13)

Features

  • Add OperatorSubscriber. (1fb14a7).
  • Add percolate operator. (e38da9e).

10.4.0 (2020-06-28)

Features

  • Add concatMapEager operator. (18952f9).

10.3.3 (2020-06-24)

Changes

  • Use tilde versions for dependencies.
  • Don't distribute the yarn.lock file.
  • Include the bundles directory in the distribution.

10.3.2 (2020-06-22)

Changes

  • Added rxjs-report-usage.

10.3.1 (2020-06-01)

Changes

  • Mutate the accumulators in combineLatestObject, forkJoinObject and zipObject operator. (d87ad0e).

10.3.0 (2020-06-01)

Features

  • Add zipObject operator. (8840d66).

10.2.1 (2020-05-20)

Fixes

  • Add equals export to the index. (057e1f2).

10.2.0 (2020-05-20)

Features

10.1.2 (2020-05-15)

Fixes

  • Add dispose call back to subscription after subscribe. (7f3dc40).

10.1.1 (2020-05-05)

Fixes

  • Put package.json files in the observable, operators and scheduler directories to enable imports from those locations. (14fead0).

10.1.0 (2020-04-28)

Changes

  • Add the debounceSync operator. (a62cff0).
  • Add skipSync and takeSync to README.md.

10.0.0 (2020-04-15)

Breaking Changes

  • The distribution now includes CommonJS and ES modules that contain non-transpiled - i.e. ES2020 - code.
  • FWIW, 9.8.0 was not published because I remembered that I'd made the above change when I was about to publish it.

9.8.0 (2020-04-15)

Features

  • Add the dispose operator. (070a9c1)

9.7.4 (2020-02-25)

Fixes

  • Clear the buffer in the delayUntil operator's implementation upon unsubscription from the delayed observable. (7e9eb13)

9.7.3 (2020-02-25)

Fixes

  • Delay indefinitely in the delayUntil operator's implementation if the notifier completes without signalling. (60790c1)

9.7.2 (2020-02-24)

Fixes

  • Delay completion in the delayUntil operator's implementation. (667be7a)

9.7.1 (2020-02-23)

Fixes

  • Replace first with take in the delayUntil operator's implementation. (10e217c)

9.7.0 (2020-02-23)

Features

  • Add the delayUntil operator. (bf0fb88)

9.6.2 (2019-05-29)

Fixes

  • Republished as the package.json files that should have been added in 9.6.1 were left out.

9.6.1 (2019-05-28)

Fixes

  • Add package.json files for all directories that are import locations.

9.6.0 (2019-05-17)

Features

  • Added the tapSubscribe operator. (fd52583)

9.5.0 (2019-04-23)

Features

  • Added bucketBy and splitBy operators. (c43c56f)

9.4.1 (2019-04-05)

Fixes

  • Specify "sideEffects": false in the package.json file. (28a8510)

9.4.0 (2018-12-08)

Features

  • Added a pause operator. (8496970)
  • Added concatTap, exhaustTap, mergeTap and switchTap operators. (bb3ab78)

9.3.1 (2018-11-18)

Fixes

  • Default the zone schedulers to using the queueScheduler. (d6f79b0)

9.3.0 (2018-10-28)

Features

  • Added a spread operator/helper. (ebd0815)

9.2.0 (2018-10-13)

Non-breaking Changes

  • Renamed the defaultObservableIfEmpty operator to concatIfEmpty and deprecated the old name. (dd9c876)

9.1.0 (2018-09-15)

Features

  • Added a finalizeWithKind operator. (fe48dfd)

Non-breaking Changes

  • Deprecated inexorably in favour of finalizeWithKind. (cfe9edf)

9.0.0 (2018-08-28)

Breaking Changes

  • Removed shareReplay. It should be fixed in RxJS, instead. (fb34d13)

8.5.0 (2018-08-27)

Features

  • Added a shareReplay implementation that unsubscribes if the reference count drops to zero.

8.4.0 (2018-08-27)

Changes

  • Renamed refCountAuditTime to refCountDelay and deprecated the former.

Features

  • Added bufferRecent.
  • Added mergeHigherOrderArray.
  • Added pairwiseStartWith.
  • Added refCountForever.

8.3.2 (2018-08-21)

Fixes

  • Fixed a problem in which the implementations of combineLatestHigherOrder/combineLatestHigherOrderObject closed over an internal, stale array. (d6296bd)

8.3.1 (2018-08-20)

Fixes

  • With combineLatestHigherOrder/combineLatestHigherOrderObject, whenever the higher-order observable emits, if all of the sources have emitted a value, emit an array/object. This also means that if the array/object of sources emitted by the higher-order obserable is empty, an empty array/object is emitted. (e93f650)

8.3.0 (2018-08-19)

Features

  • Added the combineLatestHigherOrderObject factory function. (78199bc)
  • Added the startWithTimeout operator. (667cb3c)

Fixes

  • Supported multiple, synchronous subscribes in refCountAuditTime. (ef95141)

8.2.0 (2018-08-18)

Features

  • Added the refCountOn operator. (fbc8b02)

8.1.1 (2018-08-18)

Fixes

  • Added combineLatestHigherOrder to the index. (ba4b026)

8.1.0 (2018-08-18)

Features

  • Added the combineLatestHigherOrder factory function. (ba4b026)

8.0.0 (2018-07-20)

Breaking Changes

  • Renamed the tapIndex operator to tapWithIndex and used a tuple so that either handler functions or a partial observer can be passed. (a1f9af4)

7.4.0 (2018-07-16)

Features

  • Added the indexElements operator. (435cd47)
  • Added the toggle factory function. (3cb7e4f)

Fixes

  • Fixed the TypeScript overloads the static genericPipe/pipe helper. (d42a7bb)

7.3.0 (2018-06-06)

Features

  • Added isNullish/isNotNullish helpers. (1d50d2e)
  • Added debounceTimeWithinReason. (5009619)
  • Added hasCompleted. (dfeab10)
  • Added separate. (6135b05)

7.2.1 (2018-05-20)

Fixes

  • Improve the type safety of the static genericPipe/pipe helper. (a52491e)

7.2.0 (2018-05-20)

Features

  • Added the static genericPipe/pipe helper. (239cfd1)

7.1.0 (2018-05-19)

Features

  • Added the inexorably/finalize operator. (e0e6ed0)

7.0.0 (2018-05-12)

Breaking Changes

  • Refactor traverse to use an options parameter. (07f9812)

6.4.0 (2018-05-10)

Features

  • initial: Add initial - the reverse of the subsequent operator. (c5a0b84)

6.3.0 (2018-05-05)

Features

  • Added the unsubscribeOn operator. (5200eee)

6.2.0 (2018-05-04)

Features

  • Added the instanceOf operator and the queue helper.

6.1.0 (2018-05-03)

Features

  • Added combineLatestObject and forkJoinObject.

6.0.0 (2018-04-25)

Breaking Changes

  • Upgrade to RxJS version 6.
  • Rename the UMD global to rxjsEtc.

5.0.1 (2018-04-11)

Fixes

  • traverse: The NotificationQueue no longer overrides the internal _subscribe method. (1341b26)

5.0.0 (2018-04-02)

Breaking Changes

  • traverse: A notification is now required for the traversal of the first node/page. (4b7bed2)

4.2.0 (2018-04-01)

Features

  • traverse: Add traverse observable.

4.1.1 (2018-02-21)

Bug Fixes

  • forkJoinConcurrent: Fixed the sort order of the emitted array. (b34ffcc)
  • Fixed a number of tests that were incorrect and were running.

Build

  • Switch to Webpack.

4.1.0 (2018-02-15)

Features

  • subsequent: Split out subsequent from within the debounceTimeSubsequent operator. (6112da1)

4.0.0 (2018-02-14)

Breaking Changes

  • The distribution now includes CommonJS, ES5 and ES2015 versions of the package.
  • The jsnext:main entry point has been removed from the package.json and an es2015 entry point has been added for the ES2015 files.
  • The let directory has been renamed to operators.

3.3.0 (2018-02-14)

Features

  • debounceTimeSubsequent: Add debounceTimeSubsequent for situations in which the first notification should not be debounced. (1d771c9)

3.2.0 (2018-01-28)

Features

  • pluck: Support nested keys. (04d1766)
  • reschedule: Force notifications to be emitted using a specifed scheduler. (97a583e)
  • zipPadded: Pads observables that complete whilst others continue to emit. (d671b95)
  • forkJoinConcurrent: Like forkJoin, but with a maximum concurrency. (026f0ed)

3.1.1 (2017-11-29)

Bug Fixes

  • prioritize: Support synchronous sources. (a5f09b4)

3.1.0 (2017-10-22)

Features

  • tapIndex: Add a lettable/pipeable equivalent to doIndex. (0b76d5b)

3.0.0 (2017-10-20)

Breaking Changes

  • RxJS: The implementations now use lettable/pipeable operators, so a minimum version of 5.5 is required. (48fca3a)

2.0.2 (2017-09-12)

Non-breaking Changes

  • guard: Remove unnecessary type assertion. (7fce3b5)

Build

  • Update dependencies.

2.0.1 (2017-08-13)

Bug Fixes

  • takeWhileInclusive: Filter values that pass the predicate when concatenating, so that the last value is not repeated if the source completes without a value failing the predicate. (08a60a9)

2.0.0 (2017-08-11)

Breaking Changes

  • let: Remove patching of Observable prototype from within the let methods. (25a8db8)

1.1.0 (2017-07-24)

Features

  • guard: Add optional message. (e714d9a)
  • pluck: Add type-aware pluck. (3cd4379)

Non-breaking Changes

  • defaultObservableIfEmpty: Refactor to remove do. (9596d62)