diff --git a/index.js b/index.js new file mode 100644 index 0000000000000000000000000000000000000000..ee08eabe2f451d5aae9f46badc7b51fed5fffc9f --- /dev/null +++ b/index.js @@ -0,0 +1,8 @@ +module.exports = function(initial, handlers) { + return function(state = initial, {type, ...action}) { + if (handlers.hasOwnProperty(type)) { + return handlers[type](state, action) + } + return state + } +} diff --git a/package.json b/package.json new file mode 100644 index 0000000000000000000000000000000000000000..9f4ae2d3833085d768a406c56d83b659de79c7ac --- /dev/null +++ b/package.json @@ -0,0 +1,9 @@ +{ + "name": "@commander-lol/redux-reducer", + "version": "1.0.0", + "description": "Remove the boilerplate for creating redux reducers", + "main": "index.js", + "repository": {}, + "author": "Louis Capitanchik <contact@louiscap.co>", + "license": "BSD-2-Clause" +}