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

@nxtedition/rxjs

v2.1.7

Published

RxJS utilities and custom operators.

Readme

@nxtedition/rxjs

RxJS utilities and custom operators.

Install

npm install @nxtedition/rxjs

Requires rxjs@^7 as a peer dependency.

API

cached(fn, options?, keySelector?)

Higher-order function that wraps an observable-returning function with a keyed, reference-counted cache. Subscribers sharing the same key reuse one upstream subscription. When all subscribers unsubscribe, the entry stays alive for maxAge ms before being cleaned up.

import { cached } from '@nxtedition/rxjs'

const cachedFetch = cached((id: string) => fetchRecord$(id), { maxAge: 5000 })

// Two subscribers to the same key share one upstream subscription
cachedFetch('abc').subscribe(console.log)
cachedFetch('abc').subscribe(console.log) // reuses existing subscription

Options (second argument):

  • Pass a number to set maxAge directly: cached(fn, 5000)
  • Pass null or undefined to use the default (maxAge: 1000)
  • Pass an object with:
    • maxAge — Time in ms to keep idle entries before eviction (default: 1000). Pass null or 0 for immediate cleanup.
    • bufferSize — Number of values to replay to new subscribers (default: 1). Pass 0 to disable replay.
    • keySelector — Function to derive the cache key from arguments (default: first argument).

keySelector (third argument): Overrides options.keySelector if both are provided.

auditMap(project): OperatorFunction<T, R>

Operator that subscribes to one inner observable at a time. When a new value arrives while an inner subscription is active, it stores the pending value and aborts the previous inner observable (via AbortSignal). Once the inner observable completes, it processes the most recent pending value.

The project function receives the source value and a context object with:

  • signal — An AbortSignal that fires when a newer value supersedes this one.
import { auditMap } from '@nxtedition/rxjs'

source$.pipe(auditMap((value, { signal }) => fetch(`/api/${value}`, { signal })))

combineMap(project, equals?): OperatorFunction<T[], R[]>

Operator that takes an array of keys and subscribes to an inner observable for each key. Emits an array of the latest values from all inner observables whenever any of them update.

Reuses existing subscriptions when keys are reordered or partially updated. The optional equals function controls key identity (defaults to ===).

import { combineMap } from '@nxtedition/rxjs'

keys$.pipe(combineMap((key) => fetchData$(key)))

firstValueFrom(source, config?): Promise<T | D>

Enhanced version of rxjs.firstValueFrom with AbortSignal and timeout support.

import { firstValueFrom } from '@nxtedition/rxjs'

const value = await firstValueFrom(source$, {
  signal: controller.signal,
  timeout: 5000,
  defaultValue: null,
})

lastValueFrom(source, config?): Promise<T | D>

Enhanced version of rxjs.lastValueFrom with AbortSignal and timeout support.

import { lastValueFrom } from '@nxtedition/rxjs'

const value = await lastValueFrom(source$, {
  signal: controller.signal,
  timeout: 5000,
  defaultValue: null,
})

withAbortSignal(signal): OperatorFunction<T, T>

Operator that errors the observable with an AbortError when the given AbortSignal fires.

import { withAbortSignal } from '@nxtedition/rxjs'

source$.pipe(withAbortSignal(controller.signal))

retry(config?): OperatorFunction<T, T>

Fork of the RxJS retry operator with exponential backoff (capped at 60s) and an emitOnRetry hook.

import { retry } from '@nxtedition/rxjs'

source$.pipe(
  retry({
    count: 5,
    resetOnSuccess: true,
    emitOnRetry: (err, attempt) => ({ status: 'retrying', attempt }),
  }),
)

Config:

  • count — Max retries (default: Infinity)
  • delay — A number (ms), a function returning an ObservableInput, or null for immediate retry. Default: exponential backoff.
  • resetOnSuccess — Reset retry counter on each successful emission (default: false)
  • emitOnRetry — Function called on each retry, its return value is emitted to subscribers.

AbortError

Error class thrown by withAbortSignal, firstValueFrom, and lastValueFrom on abort.

import { AbortError } from '@nxtedition/rxjs'

const err = new AbortError('custom message')
err.code // 'ABORT_ERR'
err.name // 'AbortError'

License

UNLICENSED