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

@jessemc98/simple-store

v0.0.1

Published

an experimental way to deal with state in javascript, inspired by redux

Readme

Table of Contents

Install

$ npm install --save @jessemc98/simple-store

Then with a module bundler like rollup or webpack, use as you would anything else:

// using ES6 modules
import createStore from '@jessemc98/simple-store'

// using CommonJS modules
var createStore = require('@jessemc98/simple-store')

Basic Usage

function numberReducer(state, event) {
  switch (event.type) {
    case "increment":
      return state + 1
    case "decrement":
      return state - 1
    default:
      return state
  }
}
const subscribers = { number: numberReducer }
const initialState = { number: 10 }

const store = createStore(subscribers, initialState)

store.emit({type: "increment"})
// expect(store.getState().number).toEqual(11)
store.emit({type: "decrement"})
// expect(store.getState().number).toEqual(10)

API

createStore

simple-store is an experimental way to deal with state in javascript, inspired by redux.

Returns simple-store

Parameters

  • reducers Object Required. Object full of Reducer functions.
  • initialState Object Object with the same shape as reducers parameter with initial values to set to state.

emit

Calls all reducers in store with event and current state and sets the new state to the value returned by the reducers.

Parameters

getState

Returns the current state of the store. Do not mutate any values of the returned object directly, emit events whenever you want to cause a state change otherwise subscribers will not fire.

subscribe

Subscribe to a given key in state.

Parameters

  • key String Required. Key in state to watch for changes.
  • callback Function Handler function to call with new value of state[key] whenever its value changes.

unsubscribe

Unsubscribe previously added subscriber from key in state.

Parameters

  • key String Required. Key in state to remove callback from.
  • callback Function Handler function to remove from any subscribers of state[key].

Custom event object

Object you need to pass to emit method. The only limitation is the type property is required and must be a String but otherwise it can be any javascript object with any properties.

Properties

  • type String Required. Type of event to emit.

Reducer function

A js function which is called with state and event every time an event is emitted. State is set to the return value when a reducer is called.

If state is mutated but the same object is returned subscribers will not be called so if state changes the function should return a new object.

Injected parameters

  • state any js value Current state.
  • event Custom event Object The event which was emitted that caused reducers to be called.