22
33[ ![ Build Status] ( https://travis-ci.org/jcoreio/redux-utils.svg?branch=master )] ( https://travis-ci.org/jcoreio/redux-utils )
44[ ![ Coverage Status] ( https://coveralls.io/repos/github/jcoreio/redux-utils/badge.svg?branch=master )] ( https://coveralls.io/github/jcoreio/redux-utils?branch=master )
5+ [ ![ semantic-release] ( https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg )] ( https://github.com/semantic-release/semantic-release )
56
67## createReducer([ initialState: any,] actionHandlers: {[ actionType: string] : Reducer}): Reducer
78``` js
@@ -71,6 +72,7 @@ If the decorated reducer has `actionHandlers` (from `createReducer`), then the r
7172` actionHandlers ` with the prefixed action type keys.
7273
7374### Example
75+ ``` es6
7476import {combineReducers } from ' redux'
7577import {createReducer , prefixReducer } from ' mindfront-redux-utils'
7678
@@ -87,6 +89,7 @@ const reducer = combineReducers({
8789reducer ({}, {type: ' COUNTER_1.INCREMENT' }) // {counter1: 1}
8890reducer ({counter1: 3 , counter2: 3 }, {type: ' COUNTER_1.DECREMENT' }) // {counter1: 2, counter2: 3}
8991reducer ({counter1: 3 , counter2: 3 }, {type: ' COUNTER_2.INCREMENT' }) // {counter1: 3, counter2: 4}
92+ ```
9093
9194## prefixActionCreator(prefix: string): (actionCreator: ActionCreator) => ActionCreator
9295``` js
@@ -96,6 +99,7 @@ import {prefixActionCreator} from 'mindfront-redux-utils';
9699An action creator decorator that prepends ` prefix ` to the ` type ` of the created actions.
97100
98101### Example
102+ ``` es6
99103import {prefixActionCreator } from ' mindfront-redux-utils'
100104
101105function setEntry (key , value ) {
@@ -109,6 +113,7 @@ function setEntry(key, value) {
109113const setConfigEntry = prefixActionCreator (' CONFIG.' )(setEntry)
110114
111115setConfigEntry (' hello' , ' world' ).type // CONFIG.SET_ENTRY
116+ ```
112117
113118## addMeta(meta: Object): (actionCreator: ActionCreator) => ActionCreator
114119``` js
@@ -118,6 +123,7 @@ import {addMeta} from 'mindfront-redux-utils';
118123An action creator decorator that assigns additional properties to created actions' ` meta ` .
119124
120125### Example
126+ ``` es6
121127import {addMeta } from ' mindfront-redux-utils'
122128
123129function setEntry (key , value ) {
@@ -131,4 +137,6 @@ function setEntry(key, value) {
131137const setConfigEntry = addMeta ({domain: ' config' })(setEntry)
132138
133139setConfigEntry (' hello' , ' world' ).meta // {key: 'hello', domain: 'config'}
140+ ```
141+
134142
0 commit comments