Passed
Push — master ( 4a62f7...6ccdde )
by Zhenyu
01:23
created

src/decorators/error-mute.js   A

Complexity

Total Complexity 4
Complexity/F 1.33

Size

Lines of Code 13
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 8
mnd 1
bc 1
fnc 3
dl 0
loc 13
rs 10
bpm 0.3333
cpm 1.3333
noi 0
c 0
b 0
f 0
1
import addHooks from './helpers/add-hooks';
2
3
const errorMute = ({ condition = () => true } = {}) =>
4
  addHooks({
5
    errorHook: (e, p, m, c, a) => {
6
      if (condition(e, p, m, c, a)) {
7
        return e;
8
      }
9
      return undefined;
10
    },
11
  });
12
13
export default errorMute;
14