Passed
Branch feature/phase1 (a6d58a)
by Pieter Epeüs
09:26 queued 43s
created

src/modules/multikey.js   A

Complexity

Total Complexity 4
Complexity/F 1.33

Size

Lines of Code 15
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 15
rs 10
bpm 0.3333
cpm 1.3333
noi 0
c 0
b 0
f 0
1
export default function multikey(original, key) {
2
    return original.map((value) => {
3
        const item = {};
4
5
        if (typeof key === 'object') {
6
            key.forEach((itemKey) => {
7
                item[itemKey] = value[itemKey];
8
            });
9
10
            return item;
11
        }
12
13
        return value[key];
14
    });
15
}
16