Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

combine-reducers

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

combine-reducers

A stand-alone, Redux compatible implementation of combine reducers

  • 1.0.0
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
548
increased by4.58%
Maintainers
1
Weekly downloads
 
Created
Source

Combine Reducers

travis npm downloads js-happiness-style

This is a standalone implementation of the combine reducers method from redux. You might ask, why would you not just use Redux? Redux comes with a bunch of other opinions that I personally do not fully subscribe to. Also, I hope to make some changes to improve on the existing pattern.

This module also removes most of the opinionated type checking stuff that Redux does. I would rather document the module and trust users to use it properly than add a bunch of code to force them into my opinions. Why shouldn't a reducer return undefined? Also it makes it much smaller (13 lines compared to 139).

Usage

$ npm install --save combine-reducers
var combineReducers = require('combine-reducers');

var reducer = combineReducers({
	foo: function (store, action) {
		return action.type === 'incr-foo' ? store + 1 : store;
	},
	bar: function (store, action) {
		return action.type === 'incr-bar' ? store + 1 : store;
	}
});

reducer({
	foo: 1,
	bar: 2
}, {
	type: 'incr-foo'
}); // {foo: 2, bar: 1}

Keywords

FAQs

Package last updated on 06 Feb 2016

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