All files / src/utils get.js

100% Statements 8/8
100% Branches 6/6
100% Functions 3/3
100% Lines 8/8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 158x 14x 42x 12x   30x     14x 6x     8x    
export default (array, defaulValue) => state => {
  const finalValue = array.reduce((value, nextProp) => {
    if (typeof value === 'undefined' || value === null) {
      return;
    }
    return value[nextProp];
  }, state);
 
  if (typeof finalValue === 'undefined') {
    return defaulValue;
  }
 
  return finalValue;
};