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

extractExportSpecifiers.js ➔ ... ➔ ???   A

Complexity

Conditions 1
Paths 2

Size

Total Lines 7

Duplication

Lines 0
Ratio 0 %

Code Coverage

Tests 2
CRAP Score 1

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
nc 2
nop 1
dl 0
loc 7
ccs 2
cts 2
cp 1
crap 1
rs 9.4285
c 1
b 0
f 0
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