All files / src/utils applyFunctions.js

100% Statements 9/9
100% Branches 2/2
100% Functions 7/7
100% Lines 3/3
1 2 3 4 5 6 7 8 9 10 1136x         36x       17x  
const reduceKeys = (obj) => (reducer, seed) => Object.keys(obj).reduce((acc, key) => ({
  ...acc,
  ...reducer(obj, key),
}), seed);
 
const bindFunction = (getState) => (obj, key) => ({
  [key]: typeof obj[key] === 'function' ? obj[key](getState()) : obj[key],
});
 
export default (getState) => (api) => reduceKeys(api)(bindFunction(getState), {});