Skip to content

Commit

Permalink
use curry instead of fp/curryN to be compatible with lodash-es
Browse files Browse the repository at this point in the history
  • Loading branch information
timche committed May 3, 2018
1 parent 0fa1733 commit ff7422b
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/createCurriedAction.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import curryN from 'lodash/fp/curryN';
import curry from 'lodash/curry';
import createAction from './createAction';

export default (type, payloadCreator) =>
curryN(payloadCreator.length, createAction(type, payloadCreator));
curry(createAction(type, payloadCreator), payloadCreator.length);
12 changes: 12 additions & 0 deletions test/createCurriedAction.test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import createCurriedAction from '../src/createCurriedAction';

const type = 'TYPE';

test('returns curried function', () => {
const curriedAction = createCurriedAction(type, (a, b) => a + b);

const a = curriedAction(1);
const b = a(2);

expect(b).toEqual({ payload: 3, type });
});

0 comments on commit ff7422b

Please sign in to comment.