Passed
Pull Request — master (#4)
by Swen
03:08
created

src/extractExportSpecifiers.js   A

Complexity

Total Complexity 6
Complexity/F 1.5

Size

Lines of Code 26
Function Count 4

Duplication

Duplicated Lines 0
Ratio 0 %

Test Coverage

Coverage 90%

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 0
nc 4
dl 0
loc 26
ccs 9
cts 10
cp 0.9
crap 0
rs 10
c 1
b 0
f 0
wmc 6
mnd 1
bc 4
fnc 4
bpm 1
cpm 1.5
noi 1

1 Function

Rating   Name   Duplication   Size   Complexity  
A extractExportSpecifiers.js ➔ ??? 0 17 1
1
function getSimpleType(type) {
2 54
    switch (type) {
3
    case 'ExportDefaultSpecifier':
4
        return 'default';
5
    default:
6 54
        return 'named';
7
    }
8
}
9
10 1
module.exports = (declarations, resolve) => {
0 ignored issues
show
Unused Code introduced by
The parameter resolve is not used and could be removed.

This check looks for parameters in functions that are not used in the function body and are not followed by other parameters which are used inside the function.

Loading history...
11 34
    const exps = [];
12
13 34
    declarations.forEach(node => {
14 54
        const specifiers = node.specifiers || [];
15
16 54
        specifiers.forEach(specifier => {
17 54
            exps.push({
18
                type: getSimpleType(specifier.type),
19
                name: specifier.local.name,
20
                exportedName: (specifier.exported || specifier.local).name,
21
            });
22
        });
23
    });
24
25 34
    return exps;
26
};
27