All files / src debug.js

87.5% Statements 14/16
85.71% Branches 12/14
100% Functions 2/2
86.67% Lines 13/15

Press n or j to go to the next uncovered block, b, p or k for the previous block.

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28  2x 2x 1x     1x 1x         1x 1x       1x 1x 1x 1x   1x       1x  
 
const debug = (pre = '') => {
  if (typeof pre !== 'string') {
    throw new Error('raid-addons::debug expects a string')
  }
 
  return (state, event) => {
    Iif (!console.group || !console.groupEnd) {
      console.log(pre, state, ':::', event)
      return state
    }
 
    const type = event.type || event['@@type']
    const group = type
      ? pre + ' ' + type
      : pre + ' raid'
 
    console.group(group)
    console.log(state)
    console.log(event)
    console.groupEnd(group)
 
    return state
  }
}
 
export default debug