diff --git a/src/index.js b/src/index.js index 7f3a25f..a8884ef 100644 --- a/src/index.js +++ b/src/index.js @@ -139,6 +139,17 @@ function createHistory(state) { } // /createHistory +// parseActions +export function parseActions(rawActions, defaultValue = []) { + if (Array.isArray(rawActions)) { + return rawActions; + } else if (typeof rawActions === 'string') { + return [rawActions]; + } + return defaultValue; +} +// /parseActions + // redux-undo higher order reducer export default function undoable(reducer, rawConfig = {}) { __DEBUG__ = rawConfig.debug; @@ -182,7 +193,7 @@ export default function undoable(reducer, rawConfig = {}) { return { ...state, present: res, - history: createHistory(res) + history: createHistory(res), }; } @@ -212,17 +223,6 @@ export default function undoable(reducer, rawConfig = {}) { } // /redux-undo -// parseActions -export function parseActions(rawActions, defaultValue = []) { - if (Array.isArray(rawActions)) { - return rawActions; - } else if (typeof rawActions === 'string') { - return [rawActions]; - } - return defaultValue; -} -// /parseActions - // distinctState helper export function distinctState() { return (action, currentState, previousState) => currentState !== previousState;