Passed
Pull Request — master (#141)
by
unknown
01:35
created

client/utils/components/immutable-to-js.js   A

Complexity

Total Complexity 1
Complexity/F 0

Size

Lines of Code 20
Function Count 0

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 1
eloc 16
mnd 1
bc 1
fnc 0
dl 0
loc 20
bpm 0
cpm 0
noi 0
c 0
b 0
f 0
rs 10
1
import React from 'react';
2
import { Iterable } from 'immutable';
3
4
export default Component => props => {
5
  const KEY = 0;
6
  const VALUE = 1;
7
8
  const propsInJS = Object.entries(props).reduce(
9
    (newProps, prop) => ({
10
      ...newProps,
11
      [prop[KEY]]: Iterable.isIterable(prop[VALUE])
12
        ? prop[VALUE].toJS()
13
        : prop[VALUE],
14
    }),
15
    {},
16
  );
17
18
  return <Component {...propsInJS} />;
19
};
20