diff --git a/lib/createActions.js b/lib/createActions.js index 64bcb2f..71e156d 100644 --- a/lib/createActions.js +++ b/lib/createActions.js @@ -1,5 +1,5 @@ import createTypes from './createTypes' -import { is, isNil, isEmpty, join, keys, map, mapObjIndexed, merge, pick, pipe, replace, toUpper, zipObj } from 'ramda' +import { is, isNil, isEmpty, join, keys, map, mapObjIndexed, merge, pick, pipe, replace, toUpper, zipObj, filter, mergeAll } from 'ramda' const defaultOptions = { prefix: '' @@ -41,8 +41,11 @@ const createActionCreator = (name, extraPropNames, options) => { // "properties" is defined as an array of prop names if (is(Array, extraPropNames)) { return (...values) => { - const extraProps = zipObj(extraPropNames, values) - return { type, ...extraProps } + const stringKeys = filter(n => is(String, n), extraPropNames); + const objs = filter(n => is(Object, n), extraPropNames); + const providedProps = mergeAll(objs); + const extraProps = zipObj(stringKeys, values); + return { type, ...providedProps, ...extraProps }; } }