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-modifiers

v0.0.6

Published

A collection of generic functions for writing redux reducers to operate on various data structures

Readme

Write better Redux code faster v0.0.5

Big changes from 0.0.4! API has been completely rewritten on top of ImmutableJS.

Codeship build status

A collection of generic functions on top of ImmutableJS and Redux Actions for simplifying your reducers. Declare your reducers and state as plain old javascript objects, but take advantage of Immutable guarantees and data structure traversal utilities.

Example reducer:

import { reducer, push, updateIn, removeIn } from 'redux-modifiers'

const reducer = reducer({
  'ADD_ITEM_TO_LIST': push,
  'UPDATE': updateIn,
  'ADD_NESTED_ITEM': (state, action)=>{
    let { selected, value } = action.payload; //Index of nested item (could be deeply nested, i.e. [0, 'key', 1])
    return state.updateIn(selected, item => item.push(value) ); //Using ImmutableJS API
  },
  'REMOVE': removeIn
}, []);

You can call toJS on any structure you get out of the reducer to convert it back to vanilla js, i.e. in a react component where you want to use spread operators, normal object accessors, etc. Anything you put in the reducer will automatically be converted to an ImmutableJS structure, which means you can do things like adding items to state from plain javascript objects without worrying about references sticking around.

Notes

FSA

redux-modifiers does expect that actions are dispatched as Flux Standard Actions. Essentially, this means every action looks like:

{
  type: YOUR_ACTION_TYPE,
  payload: YOUR_PAYLOAD
}

State and ImmutableJS

state is converted to an Immutable data structure, so you are free to use any ImmutableJS function you like on state. If you find you perform a particular option frequently, consider submitting a pull request and adding it to redux-modifiers!

Targeting specific parts of state

Use updateIn, to target specific parts of state, passing the update function the path that you want to update. Example state:

{
  foo: [
    {
      id: 1,
      name: 'Calvin'
    }
  ]
}

Example reducer function:

'UPDATE': updateIn

Example dispatch:

dispatch({selected: ['foo', 'name'], value: 'Calvin Froedge'});

API

push(state, action)

Payload can take any value, but you must call push on an array (List in ImmutableJS).

'ADD': push

updateIn(state, action)

Payload must include a selection path selected and a value or fn. State (or targeted key) will be replaced with value if value, or fn will be applied to the existing value.

Example payload:

{selected: [0, 'nested_array', 1], fn: value => value * 2}

removeIn(state, action)

Payload must include a selection path. Example payload:

[0, 'nested_array', 1]