diff --git a/src/Updux.ts b/src/Updux.ts index 0ef2c32..207a37d 100644 --- a/src/Updux.ts +++ b/src/Updux.ts @@ -33,7 +33,11 @@ export class Updux< ); } - get reducer() { - return (...args) => R.purry((state : DuxAggregateState, _action : any) => state, args); + get reducer(): ( state: DuxAggregateState, action: Action ) => DuxAggregateState { + return (state,action) => this.upreducer(action)(state); + } + + get upreducer(): (action: Action) => (state: DuxAggregateState) => DuxAggregateState { + return (action) => state => state; } } diff --git a/src/reducer.test.ts b/src/reducer.test.ts index 3babb7d..c668a1e 100644 --- a/src/reducer.test.ts +++ b/src/reducer.test.ts @@ -13,7 +13,7 @@ test('basic reducer', () => { test('basic upreducer', () => { const dux = new Updux({ initial: {a: 3} }); - expect(dux.reducer).toBeTypeOf('function'); + expect(dux.upreducer).toBeTypeOf('function'); - expect(dux.reducer({ type: 'foo' })({a:1})).toMatchObject({ a: 1 }); // noop + expect(dux.upreducer({ type: 'foo' })({a:1})).toMatchObject({ a: 1 }); // noop });