Total Complexity | 4 |
Complexity/F | 1.33 |
Lines of Code | 16 |
Function Count | 3 |
Duplicated Lines | 0 |
Ratio | 0 % |
Changes | 0 |
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 |