src/modules/multikey.js   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 1.33

Size

Lines of Code 15
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 100%

Importance

Changes 0
Metric Value
wmc 4
eloc 8
mnd 1
bc 1
fnc 3
dl 0
loc 15
ccs 7
cts 7
cp 1
rs 10
bpm 0.3333
cpm 1.3333
noi 0
c 0
b 0
f 0
1
export default function multikey(original, key) {
2 2
    return original.map((value) => {
3 8
        const item = {};
4
5 8
        if (typeof key === 'object') {
6 4
            key.forEach((itemKey) => {
7 8
                item[itemKey] = value[itemKey];
8
            });
9
10 4
            return item;
11
        }
12
13 4
        return value[key];
14
    });
15
}
16