Comparing version 1.0.1 to 1.0.2
{ | ||
"name": "autodux", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "Automate the Redux boilerplate.", | ||
@@ -5,0 +5,0 @@ "main": "source/index.js", |
@@ -9,2 +9,6 @@ # Autodux | ||
### Known Issues | ||
* Currently requires ES6 features. Should work great in any modern evergreen browser, but has no support for old browsers (e.g., IE). | ||
## Install | ||
@@ -125,4 +129,8 @@ | ||
selectors: { getValue }, | ||
increment, | ||
decrement | ||
actions: { | ||
increment, | ||
decrement | ||
}, | ||
reducer, | ||
initial | ||
} = counter; | ||
@@ -137,6 +145,6 @@ | ||
actions.reduce(reducer, initial); // 2 | ||
const state = actions.reduce(reducer, initial); | ||
console.log(getValue({ counter: state })); // 2 | ||
console.log(increment.type); // 'counter/increment' | ||
console.log(getValue({counter: 3})); // 3 | ||
``` |
@@ -12,3 +12,5 @@ const curry = require('lodash.curry'); | ||
const reducer = (state = initial, {type, payload} = {}) => { | ||
const [ namespace, subType ] = type.split('/'); | ||
const [ namespace, subType ] = type ? | ||
type.split('/') : | ||
'unknown/unknown'.split('/'); | ||
@@ -15,0 +17,0 @@ return (namespace === slice && actions[subType]) ? |
@@ -167,1 +167,17 @@ const test = require('tape'); | ||
}); | ||
test('Calling the reducer with no arguments', assert => { | ||
const msg = 'Should return valid default state'; | ||
const initial = { a: 'a' }; | ||
const { reducer } = autodux({ | ||
initial, | ||
actions: { | ||
reducer: x => x | ||
} | ||
}); | ||
const actual = reducer(); | ||
const expected = initial; | ||
assert.same(actual, expected, msg); | ||
assert.end(); | ||
}) |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
10921
8
221
148