From 0800bbd8959b76162b1c17d5b63bb5f092c1cffa Mon Sep 17 00:00:00 2001
From: Louis Capitanchik <contact@louiscap.co>
Date: Sun, 29 Jan 2017 16:52:00 +0000
Subject: [PATCH] browser compatible es6 was making webpack builds fail, do it
 old style

---
 .gitignore   |  1 +
 README.md    |  2 +-
 index.js     | 15 ++++++++-------
 package.json |  2 +-
 4 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/.gitignore b/.gitignore
index 397b4a7..42d824b 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
 *.log
+.idea
\ No newline at end of file
diff --git a/README.md b/README.md
index 00f23a7..cfa95cd 100644
--- a/README.md
+++ b/README.md
@@ -73,4 +73,4 @@ The library exports a single function that returns a redux-compatible reducer fu
 
 ``` reducer(initial: Object, handlers: Map<string, Handler>) ```
 
-Where initial is the `initial` router state and `handlers` is a string -> function map of action types to action reducers. Each handler is passed `state` and `action` as parameters, which correspond to the assigned reducer state and the current action (without the `type` property) and should return the new version of state after resolving the action. Simple as that. 
+Where initial is the `initial` router state and `handlers` is a string -> function map of action types to action reducers. Each handler is passed `state` and `action` as parameters, which correspond to the assigned reducer state and the current action and should return the new version of state after resolving the action. Simple as that.
diff --git a/index.js b/index.js
index ee08eab..f8b1f80 100644
--- a/index.js
+++ b/index.js
@@ -1,8 +1,9 @@
-module.exports = function(initial, handlers) {
-    return function(state = initial, {type, ...action}) {
-        if (handlers.hasOwnProperty(type)) {
-            return handlers[type](state, action)
-        }
-        return state
-    }
+module.exports = function (initial, handlers) {
+	return function (state, action) {
+		if (state == null) state = initial
+		if (handlers.hasOwnProperty(action.type)) {
+			return handlers[action.type](state, action)
+		}
+		return state
+	}
 }
diff --git a/package.json b/package.json
index ad6975f..0037123 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
 {
   "name": "@commander-lol/redux-reducer",
-  "version": "1.0.0",
+  "version": "1.0.1",
   "description": "Remove the boilerplate for creating redux reducers",
   "main": "index.js",
   "author": "Louis Capitanchik <contact@louiscap.co>",
-- 
GitLab