1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 1× 188× 171× 17× 17× | import mapValues from 'lodash.mapvalues' /** * Adds additional properties to the results of the function or map of functions passed */ export default function bindActionData(action, data) { if (typeof action === 'function') { return (...args) => ({ ...action(...args), ...data }) } Eif (typeof action === 'object') { return mapValues(action, value => bindActionData(value, data)) } return action } |