src/Format.js   A
last analyzed

Complexity

Total Complexity 4
Complexity/F 1.33

Size

Lines of Code 16
Function Count 3

Duplication

Duplicated Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
wmc 4
eloc 9
mnd 1
bc 1
fnc 3
dl 0
loc 16
bpm 0.3333
cpm 1.3333
noi 0
c 0
b 0
f 0
rs 10

1 Function

Rating   Name   Duplication   Size   Complexity  
A Format.js ➔ CSVFormatter 0 14 4
1
import { format } from 'winston';
2
3
export default function CSVFormatter(fields, options = {}) {
4
    const delim = options.delimiter || ';';
5
    const missed = options.missed || '';
6
7
    return format.printf(logObject => {
8
        const data = fields.map(key => {
9
            const value = logObject[key];
10
11
            return value === undefined ? missed : value;
12
        });
13
14
        return data.join(delim);
15
    });
16
}
17