npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

any-observable

v0.6.0

Published

Support any Observable library and polyfill

Readme

any-observable

Support any Observable library and polyfill

Install

npm install any-observable

You must also install the Observable library you want:

npm install zen-observable

Usage

import Observable from 'any-observable'; // Using `zen-observable` since it's installed

Observable.of(1, 2).forEach(value => {
	console.log(value);
});
//=> 1
//=> 2

Optional import

If you want to attempt loading without throwing, use the optional entrypoint. It returns undefined when no implementation is available:

import Observable from 'any-observable/optional';

if (Observable === undefined) {
	console.log('No Observable implementation available');
}

Registration Shortcuts

This adds the following shortcut registrations:

  • rxjs-min: Bare bones RxJs Observable implementation. See the RxJs Installation Instructions for details on patching additional methods into that implementation.
  • rxjs: Same as rxjs-min, but adds the somewhat standard Observable.of and Observable.from.
  • rxjs-all: The kitchen sink approach to Observables.
  • zen: The zen-observable implementation.

Shortcut registration can be done as follows:

import 'any-observable/register/zen';

It's especially handy for environments that support preloading ESM modules:

node --import=any-observable/register/zen test.js

Browser native ESM registration

Use the async helper when you want to probe multiple implementations in a browser native ESM setup:

import registerAsync from 'any-observable/register/async';

await registerAsync([
	'rxjs',
	'zen-observable'
]);

const {default: Observable} = await import('any-observable');

This requires import maps or URL specifiers for the implementations you probe, and it must run before any import 'any-observable'.

Compatibility and interop

any-observable expects an ES Observable implementation (a constructor), not just interop on stream instances. Libraries like most, Kefir, Bacon, xstream, and Flyd are not supported directly unless they provide an ES Observable constructor. If your library can convert to an ES Observable, use that and register explicitly:

import register from 'any-observable/register';

register('custom', {Observable: YourObservable});

For library authors

If your library depends on Observables via any-observable, follow these guidelines:

  • Do not call register yourself. Leave Observable implementation choice to the end user.
  • Do not rely on non-standard features. Stick to the ES Observable spec so any compliant implementation works.
  • Document any-observable support prominently. Let users know they need to install and register an Observable implementation.

Related