1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 | 1× 1× 1147× 1036× 111× 978× 54× | import mapValues from './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 }); } if (typeof action === 'object') { return mapValues(action, value => bindActionData(value, data)); } return action; } |