-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathapp.js
More file actions
29 lines (27 loc) · 1.57 KB
/
app.js
File metadata and controls
29 lines (27 loc) · 1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
var helper = require('./lib/helper');
var colours = require('colors');
async function main() {
// TODO can be improved to read files from sampler folder instead of limiting to use file name to supply
helper.getProccessedData(`${process.cwd()}//testdata//sampler_location//sydney-temperatures.csv`)
.then((processdData) => {
console.log(colours.cyan('| %s |'), '================================');
console.log(colours.yellow('| %s |'), 'Lowest temperature spread month');
console.log(colours.cyan('| %s |'), '================================');
console.log(colours.magenta('| %s | %s |'), 'Month', 'Spread');
for (item of processdData[0].lowMonths) {
console.log('| %s | %s |', item.Month, item.spread);
}
console.log(colours.cyan('| %s |'), '============================================');
console.log(colours.yellow('| %s |'), ' Temperature spread ');
console.log(colours.cyan('| %s |'), '============================================');
console.log(colours.magenta('| %s | %s | %s | %s |'), 'Month', 'Mean Maximum', 'Mean Minimum', 'Spread');
for (item of processdData[1].originalData) {
console.log('| %s | %s | %s | %s |', item.Month, item.maximum, item.minimum, item.spread);
}
console.log('| %s |', colours.cyan('============================================'));
})
.catch((err) => console.log(err.message));
}
main().catch(reason => {
throw reason;
});