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

actionize

v1.0.1

Published

A small library to help build Redux reducers and their associated actions.

Downloads

14

Readme

Actionize

A small library to help build Redux reducers and their associated actions.

NPM Version NPM License Build Test Coverage

Actionize helps you build Redux reducers without having to write large switch statements to handle actions or create action factories to call them. Actionize maintains a set of reducer names and ensures they are unique; this ensures all actions have unique names for dispatching.

Simple Example

import Actionize from 'actionize';
const actionize = new Actionize();

// Create a reducer:
const todoList = actionize.define('todos.list', build => build.reducer([], {

	// An action:
	// Takes the current state and arguments, and returns the new state.
	add(state, { text }) {
		return [
			...state,
			{ id: state.length + 1, text: text, done: false }
		];
	},

	complete(state, { id }) {
		return state.map(value => value.id === id
			? Object.assign({}, value, { done: true })
			: value
		);
	}
}));

API Reference

The Actionize API is handled through two classes, Actionize and ActionizeBuild.

The .set and .define function on the Actionize class are given a builder which receives an instance of ActonizeBuild.

Actionize

new Actionize

new Actionize(options)

Create a new instance of actionize. The given options are:

|Option|| |:---|:---| |context|A function that returns the this context for action handlers in the format function(action, reducer)| |Immutable|A reference to the Immutable JS library instance. This is used for .combineImmutable and .nestImmutable|

.set

.set(string name, function(ActionizeBuild build) builder)

Set a reducer by name. The builder function should return the reducer. The name given must be unique per instance of Actionize.

This function is lazy and will not call builder until .get is called for the same name.

actionize.set('foo', build => build.reducer({}, {
	doSomething(state, { arg }) {
		return { ...state, arg };
	}
});

.define

.define(string name, function(ActionizeBuild build) builder)

Same as .set, but not lazy. Returns the reducer from builder immediately.

const fooReducer = actionize.define('foo', build => build.reducer(...));

.get

.get(string name)

Get a reducer by name. This will invoke the builder prebiously given to .set for the same name. If .get was called previously for the same name, the same instance will be returned.

actionize.set('foo', build => build.reducer(...));
// ...
const fooReducer = actionize.get('foo');

.dispatcher

.dispatcher(function reducer, function reduxStoreDispatch)

Create a dispatcher object from the given reducer and Redux dispatch store. This will allow calling functions directly on the dispatcher without needing a reference to the redux store.

actionize.dispatcher(actions, reduxStoreDispatch)

|Argument|| |:---|:---| |reducer|A reducer.| |reduxStoreDispatch|The Redux store.dispatch function.|

const todoListActions = actionize.dispatcher(todoList, store.dispatch);

todoListActions.edit({
	id: 123,
	todo: { text: 'foo' }
});

License

MIT