Socket
Socket
Sign inDemoInstall

create-store

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

create-store

Create redux store from object of action handlers.


Version published
Maintainers
1
Created
Source

create-store

Create a redux store from an object of action handling functions, keyed by the actions they handle. Has createStore.compose(fns) helper function to combine multiple action handlers into a single action. Big thanks to dlmanning, our conversations lead me here.

var createStore = require('create-store')

// setup handlers, object keys for action types
var handlers =
  { add: add
  , multiply: multiply
  // compose handler functions together for compound actions.
  , addThenMultiply: createStore.compose(add, multiply)
  }

// create a store from the handlers, this is normaly what would be exported.
var store = createStore(handlers)

// actual action handling functions, down out of the way.
function add (store, action) {
  store.num += action.num
  return store
}

function multiply (store, action) {
  store.num *= action.num
  return store
}

Keywords

FAQs

Package last updated on 12 Sep 2015

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc