Passed
Push — 1 ( f8e5cb...ba63b3 )
by Robbie
03:44
created

client/src/boot/applyConditionals.js   A

Complexity

Total Complexity 4
Complexity/F 1.33

Size

Lines of Code 25
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 4
dl 0
loc 25
rs 10
c 1
b 0
f 0
cc 0
nc 1
mnd 1
bc 4
fnc 3
bpm 1.3333
cpm 1.3333
noi 0

1 Function

Rating   Name   Duplication   Size   Complexity  
A applyConditionals.js ➔ ??? 0 21 1
1
import Injector from 'lib/Injector';
2
3
const applyConditionals = () => {
4
  Injector.transform(
5
    'add-to-campaign',
6
    (updater) => {
7
      updater.form.alterSchema(
8
        '*.AddToCampaign',
9
        (form) => {
10
          const toggle = form.getFieldByName('AddNewSelect');
11
          if (!toggle) {
12
            return form.getState();
13
          }
14
          const visible = form.getValue('AddNewSelect');
15
          return form
16
            .setFieldClass('NewTitle', 'show', visible)
17
            .setFieldClass('NewTitle', 'hide', !visible)
18
            .getState();
19
        }
20
      );
21
    }
22
  );
23
};
24
25
export default applyConditionals;
26