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

redux-watch-immutable

v1.0.0

Published

Watch Immutable.js values in a Redux store

Readme

Redux Watch Immutable

Watch values in an Immutable.js Redux state tree. Version 1 modernizes the original package as standards-based ESM JavaScript while preserving the classic setStore, setCompareFn, and watch API.

The package ships its source directly: there is no build step. Invalid arguments throw TypeError instead of being silently accepted or logged.

Install

npm install redux-watch-immutable immutable redux

immutable and redux are peer dependencies. Supported versions are Immutable.js 4 or 5 and Redux 3 or newer. Node.js 20 or newer is required.

Usage

import {setCompareFn, setStore, watch} from 'redux-watch-immutable';
import {is} from 'immutable';
import store from './store.js';

setStore(store);
setCompareFn(is);

const removeWatcher = watch('admin.name', (name, previousName, path) => {
  console.log('new name', name, {previousName, path});
});

// Later:
removeWatcher();

Version 1 is ESM-only. CommonJS require() is not supported.

The source uses // @ts-check and documented JSDoc types, which provide type information and editor feedback in JavaScript projects. The package does not bundle TypeScript declaration (.d.ts) files.

API

setStore(store, customStateGetter?)

Configures the Redux-compatible store and initializes the current state. The store must provide getState() and subscribe() methods. State values are read through Immutable.js getIn(path).

An optional state getter can select the Immutable state when it is nested inside another value:

setStore(store, (configuredStore) => configuredStore.getState().immutableState);

Calling setStore again unsubscribes from the previously configured store when its subscription provides an unsubscribe function.

setCompareFn(compareFn)

Sets the equality function used by all watchers. It receives the current and previous values and must return true when they should be considered equal. Strict equality (===) is used by default.

import {is} from 'immutable';

setCompareFn(is);

watch(objectPath, callback)

Watches a non-empty dot-separated path such as admin.name. The callback runs asynchronously after the store subscription fires and receives:

  1. the new value;
  2. the previous value;
  3. the path as an array of strings.
const unsubscribe = watch('admin.name', (name, previousName, path) => {
  console.log({name, previousName, path});
});

unsubscribe();

Registering the same callback more than once for the same path does not duplicate notifications. Calling the returned function removes that callback. Missing Immutable.js paths resolve to undefined safely.

Upgrading from v0

  • Version 1 is ESM-only; CommonJS require() is not supported.
  • Node.js 20 or newer is required.
  • Invalid arguments now throw TypeError.
  • setCompareFn now correctly applies the comparator passed to it.
  • Malformed paths with leading, trailing, or consecutive dots now throw TypeError.

Development

npm install
npm test
npm run typecheck
npm pack --dry-run

License

MIT

Copyright (c) Arnaud Tanielian, Abhaya Rawal