Skip to content

Commit

Permalink
Patch updates initial state handling
Browse files Browse the repository at this point in the history
  • Loading branch information
kristoferjoseph committed Apr 12, 2018
1 parent a2b3598 commit 862b426
Show file tree
Hide file tree
Showing 5 changed files with 159 additions and 76 deletions.
7 changes: 6 additions & 1 deletion index.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,15 @@ module.exports = function Redeux (initialState) {
var l = args.length
var i = 0
var r
var key
for (i; i < l; i++) {
r = args[i]
typeof r === 'function' &&
key = r.key || r.name
if (typeof r === 'function') {
reducers.push(r)
state[key] = r(state[key])
reducers.push(r)
}
}
return reducers.length
}
Expand Down
163 changes: 104 additions & 59 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

13 changes: 9 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,19 @@
"description": "Minimal unidirectional data flow utility",
"main": "index.js",
"scripts": {
"test": "npm run test:node && npm run test:browser",
"test:node": "tape ./test.js | tap-spec",
"test:browser": "browserify ./test.js | tape-run --render=tap-spec",
"test": "standard && npm run test:node && npm run test:browser",
"test:node": "tape ./test.js | tap-format-spec",
"test:browser": "browserify ./test.js | tape-run | tap-format-spec",
"benchmark": "npm run benchmark:node && npm run benchmark:web",
"benchmark:node": "node ./benchmark/index.js",
"benchmark:web": "browserify ./benchmark/index.js > ./benchmark/bundle.js && open ./benchmark/index.html",
"umd": "browserify ./index.js --standalone redeux | uglifyjs --compress --mangle > redeux.umd.js"
},
"standard": {
"ignore": [
"*.umd.js"
]
},
"repository": {
"type": "git",
"url": "git+https://github.com/kristoferjoseph/redeux.git"
Expand All @@ -30,9 +35,9 @@
},
"homepage": "https://github.com/kristoferjoseph/redeux#readme",
"devDependencies": {
"@tap-format/spec": "^0.2.0",
"browserify": "^16.0.0",
"standard": "*",
"tap-spec": "^4.1.1",
"tape": "^4.8.0",
"tape-run": "^3.0.3",
"uglify-js": "^3.3.10"
Expand Down
2 changes: 1 addition & 1 deletion redeux.umd.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 862b426

Please sign in to comment.