Skip to content

Commit

Permalink
composeReducers -> combineReducers
Browse files Browse the repository at this point in the history
  • Loading branch information
gaearon committed Jul 8, 2015
1 parent 1791e2a commit 039c30f
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
4 changes: 2 additions & 2 deletions src/createStore.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import Store from './Store';
import composeReducers from './utils/composeReducers';
import combineReducers from './utils/combineReducers';

export default function createStore(
reducer,
initialState
) {
const finalReducer = typeof reducer === 'function' ?
reducer :
composeReducers(reducer);
combineReducers(reducer);

const store = new Store(finalReducer, initialState);

Expand Down
4 changes: 2 additions & 2 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ import createStore from './createStore';

// Utilities
import compose from './utils/compose';
import composeReducers from './utils/composeReducers';
import combineReducers from './utils/combineReducers';
import bindActionCreators from './utils/bindActionCreators';
import applyMiddleware from './utils/applyMiddleware';
import composeMiddleware from './utils/composeMiddleware';

export {
createStore,
compose,
composeReducers,
combineReducers,
bindActionCreators,
applyMiddleware,
composeMiddleware
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ function getErrorMessage(key, action) {
);
}

export default function composeReducers(reducers) {
export default function combineReducers(reducers) {
const finalReducers = pick(reducers, (val) => typeof val === 'function');

return function composition(state = {}, action) {
Expand Down
12 changes: 6 additions & 6 deletions test/composeReducers.spec.js → test/combineReducers.spec.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
import expect from 'expect';
import { composeReducers } from '../src';
import { combineReducers } from '../src';

describe('Utils', () => {
describe('composeReducers', () => {
describe('combineReducers', () => {
it('should return a composite reducer that maps the state keys to given reducers', () => {
const reducer = composeReducers({
const reducer = combineReducers({
counter: (state = 0, action) =>
action.type === 'increment' ? state + 1 : state,
stack: (state = [], action) =>
Expand All @@ -18,7 +18,7 @@ describe('Utils', () => {
});

it('ignores all props which are not a function', () => {
const reducer = composeReducers({
const reducer = combineReducers({
fake: true,
broken: 'string',
another: { nested: 'object' },
Expand All @@ -31,7 +31,7 @@ describe('Utils', () => {
});

it('should throw an error if a reducer returns undefined', () => {
const reducer = composeReducers({
const reducer = combineReducers({
undefinedByDefault(state = 0, action) {
switch (action && action.type) {
case 'increment':
Expand Down Expand Up @@ -65,7 +65,7 @@ describe('Utils', () => {
});

it('should throw an error if a reducer returns undefined initializing', () => {
const reducer = composeReducers({
const reducer = combineReducers({
undefinedInitially(state, action) {
switch (action.type) {
case 'increment':
Expand Down

0 comments on commit 039c30f

Please sign in to comment.