-
-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathindex.js
82 lines (77 loc) · 2.5 KB
/
index.js
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
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
"use strict";
//
// Example command line app to generate report from some hard-coded data.
// The generateReport function is imported from a reusable code module.
//
const data = [
{
"dive_divers": "Anjani Ganase, Christophe Bailhache",
"dive_end_lat": "16'11.491S",
"dive_end_lng": "145'53.630E",
"dive_start_lat": "16'11.316S",
"dive_start_lng": "145'53.883E",
"dive_temperature": 0,
"dive_visibility": 20,
"duration": 37,
"end_datetime": "2012-09-16 16:53:00",
"reef_name": "Opal Reef",
"start_datetime": "2012-09-16 16:16:00",
},
{
"dive_divers": "Christophe Bailhache, Manuel Gonzalez Rivero",
"dive_end_lat": "",
"dive_end_lng": "",
"dive_start_lat": "",
"dive_start_lng": "",
"dive_temperature": 0,
"dive_visibility": 20,
"duration": 60,
"end_datetime": "2012-09-17 11:54:00",
"reef_name": "Opal Reef",
"start_datetime": "2012-09-17 10:54:00",
},
{
"dive_divers": "Christophe Bailhache, Manuel Gonzalez Rivero",
"dive_end_lat": "",
"dive_end_lng": "",
"dive_start_lat": "",
"dive_start_lng": "",
"dive_temperature": 25.5,
"dive_visibility": 20,
"duration": 40,
"end_datetime": "2012-09-18 14:10:05",
"reef_name": "Opal Reef",
"start_datetime": "2012-09-18 13:30:16",
},
{
"dive_divers": "Christophe Bailhache, Manuel Gonzalez Rivero",
"dive_end_lat": "",
"dive_end_lng": "",
"dive_start_lat": "",
"dive_start_lng": "",
"dive_temperature": 0,
"dive_visibility": 0,
"duration": 43,
"end_datetime": "2012-09-20 13:26:24",
"reef_name": "Holmes Reef",
"start_datetime": "2012-09-20 12:43:39",
},
{
"dive_divers": "Christophe Bailhache, Anjani Ganase",
"dive_end_lat": "",
"dive_end_lng": "",
"dive_start_lat": "",
"dive_start_lng": "",
"dive_temperature": 26.4,
"dive_visibility": 40,
"duration": 42,
"end_datetime": "2012-09-20 16:26:02",
"reef_name": "Holmes Reef",
"start_datetime": "2012-09-20 15:43:39",
}
];
const generateReport = require("./generate-report.js");
const report = generateReport(data);
console.log("Number of rows: " + report.numRows);
console.log("Number of columns: " + report.numColumns);
console.log("Columns: " + report.columnNames.join(", "));