-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdata.js
More file actions
211 lines (207 loc) · 5.09 KB
/
data.js
File metadata and controls
211 lines (207 loc) · 5.09 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
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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
import fs from "fs"
const data = [
[
"no",
"date",
"clue1",
"answer1",
"clue2",
"answer2",
"jwclue",
"joinedword",
"difficulty"
],
[
"1",
"2-13-2022",
"An important aspect of food",
"Taste",
"You might see them on some plants",
"Buds",
"We often try to satisfy them",
"Tastebuds",
"Medium"
],
[
"2",
"2-14-2022",
"Something you might see in a park",
"Bench",
"A Christian Name",
"Mark",
"Something people aspire to beat",
"Benchmark",
"Medium"
],
[
"3",
"2-15-2022",
"A thing people do almost everyday",
"Drive",
"Google Maps helps you find it",
"Way",
"It's normally in front of a house or building",
"Driveway",
"Easy"
],
[
"4",
"2-16-2022",
"Often seen in the night sky",
"Moon",
"We can't see without it",
"Light",
"Makes walking on the beach more romantic",
"Moonlight",
"Easy"
],
[
"5",
"2-17-2022",
"A thing we do on the internet",
"Surf",
"Large companies have one",
"Board",
"A beach companion",
"Surfboard",
"Medium"
],
[
"6",
"2-18-2022",
"You can get one at a hotel",
"Dish",
"Earlier common in taps",
"Washer",
"A household appliance",
"Dishwasher",
"Medium"
],
[
"7",
"2-19-2022",
"A type of juice",
"Lime",
"These type of things are easy to carry",
"Light",
"It's nice to be in this at times",
"Limelight",
"Medium"
],
[
"8",
"2-20-2022",
"A group of musicians",
"Band",
"A dimension",
"Width",
"Something that can improve your internet speed",
"Bandwidth",
"Easy"
],
[
"9",
"2-21-2022",
"Something that never ends",
"Loop",
"Found in old clothes",
"Hole",
"Something people tend to exploit",
"Loophole",
"Easy"
],
[
"10",
"2-22-2022",
"What remains from a fire",
"Ash",
"Used to serve drinks",
"Tray",
"Smokers use them",
"Ashtray",
"Easy"
],
[
"11",
"2-23-2022",
"A thing you can do with your lips",
"Whistle",
"A thing that’s used for cleaning",
"Blower",
"A person who warns you",
"Whistleblower",
"Medium"
],
[
"12",
"2-24-2022",
"You often have to do this at an airport",
"Wait",
"A thing that accompanies shopping",
"List",
"This could happen when you try to book a ticket",
"Waitlist",
"Medium"
],
[
"13",
"2-25-2022",
"A metal",
"Gold",
"Belongs to you",
"Mine",
"A treasure",
"Goldmine",
"Easy"
],
[
"14",
"2-26-2022",
"We need it when we are in trouble",
"Help",
"We often stand in one",
"Line",
"A telephone service",
"Helpline",
"Easy"
],
[
"15",
"2-27-2022",
"A thing you might use at night",
"Torch",
"A word associated with cheque / check",
"Bearer",
"A person who leads from the front",
"Torchbearer",
"Hard"
],
[
"16",
"2-28-2022",
"What you use a knife for",
"Cut",
"Another word for rent",
"Let",
"A tasty snack",
"Cutlet",
"Easy"
],
]
const keys = data[0];
// Transform the data
const result = data.slice(1).map(row => {
return keys.reduce((acc, key, index) => {
acc[key] = row[index] || null; // Use null if the value is undefined
return acc;
}, {});
});
console.log(result);
// Write the result to a JSON file
fs.writeFile('data.json', JSON.stringify(result, null, 2), (err) => {
if (err) {
console.error('Error writing to file:', err);
} else {
console.log('Data successfully written to data.json');
}
});