Skip to content

Commit 994f619

Browse files
committed
Fixed formatting
1 parent 6b57a1e commit 994f619

File tree

3 files changed

+88
-88
lines changed

3 files changed

+88
-88
lines changed

bin/util/chart.js

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,15 @@
1-
const chart = require('asciichart');
1+
const chart = require("asciichart");
22

33
// generate chart for cases or deaths
4-
exports.generate = (data, type = 'cases') => {
5-
const history = data[type] ? Object.values(data[type]) : Object.values(data.timeline[type]),
6-
maxLength = history.reduce((a,c) => Math.max(a, c.toFixed().length), 0),
7-
chartData = Object.values(history).flat(),
8-
config = {
9-
height: 7,
10-
format: (x, i) => x.toFixed().padStart(maxLength)
11-
};
12-
return chart.plot(chartData, config);
13-
}
4+
exports.generate = (data, type = "cases") => {
5+
const history = data[type]
6+
? Object.values(data[type])
7+
: Object.values(data.timeline[type]),
8+
maxLength = history.reduce((a, c) => Math.max(a, c.toFixed().length), 0),
9+
chartData = Object.values(history).flat(),
10+
config = {
11+
height: 7,
12+
format: (x, i) => x.toFixed().padStart(maxLength),
13+
};
14+
return chart.plot(chartData, config);
15+
};

bin/util/index.js

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,13 @@
1-
const { Readable } = require('stream');
1+
const { Readable } = require("stream");
22

3-
const isCommandline = (userAgent) => {
4-
return (userAgent.search(/curl|wget|httpie/i) !== -1);
5-
};
3+
const isCommandline = (userAgent) =>
4+
userAgent.search(/curl|wget|httpie/i) !== -1;
65

76
const getStream = (req, res) => {
87
const stream = new Readable();
98
stream.pipe(res);
109
stream._read = () => {};
11-
req.on('close', () => {
10+
req.on("close", () => {
1211
stream.destroy();
1312
});
1413
return stream;

bin/util/layout.js

Lines changed: 71 additions & 72 deletions
Original file line numberDiff line numberDiff line change
@@ -1,77 +1,76 @@
11
exports.md = {
2-
grid: {},
3-
header: {
4-
grid: [0, 0, 2, 2]
5-
},
6-
table: {
7-
grid: [0, 2, 2, 7]
8-
},
9-
bar: {
10-
grid: [2, 4, 3, 3]
11-
},
12-
map: {
13-
grid: [2, 0, 3, 4]
14-
},
15-
donut: {
16-
grid: [2, 7, 3, 2]
17-
},
18-
line: {
19-
grid: [5, 0, 4, 9]
20-
},
21-
footer: {
22-
grid: [8, 0, 2, 9]
23-
}
24-
}
2+
grid: {},
3+
header: {
4+
grid: [0, 0, 2, 2],
5+
},
6+
table: {
7+
grid: [0, 2, 2, 7],
8+
},
9+
bar: {
10+
grid: [2, 4, 3, 3],
11+
},
12+
map: {
13+
grid: [2, 0, 3, 4],
14+
},
15+
donut: {
16+
grid: [2, 7, 3, 2],
17+
},
18+
line: {
19+
grid: [5, 0, 4, 9],
20+
},
21+
footer: {
22+
grid: [8, 0, 2, 9],
23+
},
24+
};
2525

2626
exports.lg = {
27-
grid: {},
28-
header: {
29-
grid: [0, 0, 1, 10]
30-
},
31-
table: {
32-
grid: [1, 0, 2, 10]
33-
},
34-
bar: {
35-
grid: [3, 5, 3, 3]
36-
},
37-
map: {
38-
grid: [3, 0, 3, 5]
39-
},
40-
donut: {
41-
grid: [3, 8, 3, 2]
42-
},
43-
line: {
44-
grid: [6, 0, 4, 10]
45-
},
46-
footer: {
47-
grid: [9, 0, 2, 10]
48-
}
49-
}
27+
grid: {},
28+
header: {
29+
grid: [0, 0, 1, 10],
30+
},
31+
table: {
32+
grid: [1, 0, 2, 10],
33+
},
34+
bar: {
35+
grid: [3, 5, 3, 3],
36+
},
37+
map: {
38+
grid: [3, 0, 3, 5],
39+
},
40+
donut: {
41+
grid: [3, 8, 3, 2],
42+
},
43+
line: {
44+
grid: [6, 0, 4, 10],
45+
},
46+
footer: {
47+
grid: [9, 0, 2, 10],
48+
},
49+
};
5050

5151
exports.sm = {
52-
grid: {},
53-
header: {
54-
grid: [0, 0, 2, 2]
55-
},
56-
table: {
57-
grid: [2, 0, 2, 5],
58-
columnSpacing: 3
59-
},
60-
bar: {
61-
grid: [4, 0, 3, 3],
62-
xOffset: 6
63-
},
64-
map: {
65-
grid: [0, 2, 2, 3]
66-
},
67-
donut: {
68-
grid: [4, 3, 3, 2]
69-
},
70-
line: {
71-
grid: [7, 0, 3, 5]
72-
},
73-
footer: {
74-
grid: [9, 0, 2, 5]
75-
}
76-
}
77-
52+
grid: {},
53+
header: {
54+
grid: [0, 0, 2, 2],
55+
},
56+
table: {
57+
grid: [2, 0, 2, 5],
58+
columnSpacing: 3,
59+
},
60+
bar: {
61+
grid: [4, 0, 3, 3],
62+
xOffset: 6,
63+
},
64+
map: {
65+
grid: [0, 2, 2, 3],
66+
},
67+
donut: {
68+
grid: [4, 3, 3, 2],
69+
},
70+
line: {
71+
grid: [7, 0, 3, 5],
72+
},
73+
footer: {
74+
grid: [9, 0, 2, 5],
75+
},
76+
};

0 commit comments

Comments
 (0)