Skip to content

Commit 5073538

Browse files
committed
Merge pull request reduxjs#79 from emmenko/consistent-naming
Export default middlewares and use consistent naming
2 parents 950d1b8 + 3d21465 commit 5073538

File tree

4 files changed

+9
-9
lines changed

4 files changed

+9
-9
lines changed

src/createDispatcher.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import compose from './utils/composeMiddleware';
1+
import composeMiddleware from './utils/composeMiddleware';
22

33
export default function createDispatcher(store, middlewares = []) {
44
return function dispatcher(initialState, setState) {
@@ -17,6 +17,6 @@ export default function createDispatcher(store, middlewares = []) {
1717
middlewares = middlewares(getState);
1818
}
1919

20-
return compose(...middlewares, dispatch);
20+
return composeMiddleware(...middlewares, dispatch);
2121
};
2222
}

src/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ export createRedux from './createRedux';
33
export createDispatcher from './createDispatcher';
44

55
// Utilities
6-
export compose from './utils/composeMiddleware';
6+
export composeMiddleware from './utils/composeMiddleware';
77
export composeStores from './utils/composeStores';
88
export bindActionCreators from './utils/bindActionCreators';

src/utils/composeMiddleware.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
1-
export default function compose(...middlewares) {
1+
export default function composeMiddleware(...middlewares) {
22
return middlewares.reduceRight((composed, m) => m(composed));
33
}
Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import expect from 'expect';
2-
import { compose } from '../src';
2+
import { composeMiddleware } from '../src';
33

44
describe('Utils', () => {
5-
describe('compose', () => {
5+
describe('composeMiddleware', () => {
66
it('should return combined middleware that executes from left to right', () => {
77
const a = next => action => next(action + 'a');
88
const b = next => action => next(action + 'b');
99
const c = next => action => next(action + 'c');
1010
const dispatch = action => action;
1111

12-
expect(compose(a, b, c, dispatch)('')).toBe('abc');
13-
expect(compose(b, c, a, dispatch)('')).toBe('bca');
14-
expect(compose(c, a, b, dispatch)('')).toBe('cab');
12+
expect(composeMiddleware(a, b, c, dispatch)('')).toBe('abc');
13+
expect(composeMiddleware(b, c, a, dispatch)('')).toBe('bca');
14+
expect(composeMiddleware(c, a, b, dispatch)('')).toBe('cab');
1515
});
1616
});
1717
});

0 commit comments

Comments
 (0)