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

immer-reducer

Package Overview
Dependencies
Maintainers
1
Versions
28
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

immer-reducer - npm Package Compare versions

Comparing version 0.1.3 to 0.1.4

LICENSE

11

lib/immer-reducer.js

@@ -39,3 +39,3 @@ "use strict";

return {
type: PREFIX + ":" + key,
type: PREFIX + ":" + immerReducerClass.name + "#" + key,
payload: args,

@@ -56,6 +56,9 @@ };

}
var methodKey = removePrefix(action.type);
if (typeof immerReducerClass.prototype[methodKey] !== "function") {
var _a = removePrefix(action.type).split("#"), className = _a[0], methodName = _a[1];
if (className !== immerReducerClass.name) {
return state;
}
if (typeof immerReducerClass.prototype[methodName] !== "function") {
return state;
}
if (!state) {

@@ -66,3 +69,3 @@ throw new Error("ImmerReducer does not support undefined state. Pass initial state to createReducerFunction() or createStore()");

var reducers = new immerReducerClass(draftState, state);
reducers[methodKey].apply(reducers, action.payload);
reducers[methodName].apply(reducers, action.payload);
return draftState;

@@ -69,0 +72,0 @@ });

{
"name": "immer-reducer",
"version": "0.1.3",
"version": "0.1.4",
"description": "",

@@ -5,0 +5,0 @@ "main": "lib/immer-reducer.js",

@@ -9,2 +9,4 @@ # Immer Reducer

Read an introductory [blog post here](https://medium.com/@esamatti/type-safe-boilerplate-free-redux-906844ec6325).
## Install

@@ -23,3 +25,2 @@

class MyImmerReducer extends ImmerReducer {
// each method becomes an Action Creator

@@ -80,7 +81,7 @@ setFirstName(firstName) {

{
type: "IMMER_REDUCER:setFirstName",
type: "IMMER_REDUCER:MyImmerReducer#setFirstName",
payload: ["Charlie"],
}
{
type: "IMMER_REDUCER:setLastName",
type: "IMMER_REDUCER:MyImmerReducer#setLastName",
payload: ["Brown"],

@@ -157,6 +158,6 @@ }

## Type Safe connect()?
## Examples
If you enjoy this then also checkout
[redux-render-prop](https://github.com/epeli/redux-render-prop) for type safe
`connect()` alternative.
Here's a more complete example with [redux-render-prop](https://github.com/epeli/redux-render-prop):
<https://github.com/epeli/typescript-redux-todoapp>

Sorry, the diff of this file is not supported yet

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