@tricoteuses/senat 2.10.2 → 2.10.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/loaders.js +10 -14
- package/package.json +1 -1
package/lib/loaders.js
CHANGED
|
@@ -198,25 +198,21 @@ export function* iterLoadSenatAgendasGrouped(dataDir, session) {
|
|
|
198
198
|
.sort();
|
|
199
199
|
for (const fileName of files) {
|
|
200
200
|
const filePath = path.join(baseDir, fileName);
|
|
201
|
-
let
|
|
201
|
+
let raw;
|
|
202
202
|
try {
|
|
203
|
-
|
|
203
|
+
raw = fsex.readJSONSync(filePath);
|
|
204
204
|
}
|
|
205
205
|
catch {
|
|
206
|
-
continue;
|
|
206
|
+
continue; // JSON invalide
|
|
207
207
|
}
|
|
208
|
-
if (!
|
|
208
|
+
if (!raw || typeof raw !== "object")
|
|
209
209
|
continue;
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if (!Array.isArray(gr.events))
|
|
217
|
-
gr.events = [];
|
|
218
|
-
yield { item: gr };
|
|
219
|
-
}
|
|
210
|
+
const gr = raw;
|
|
211
|
+
if (!gr.uid || !gr.date || !gr.titre)
|
|
212
|
+
continue;
|
|
213
|
+
if (!Array.isArray(gr.events))
|
|
214
|
+
gr.events = [];
|
|
215
|
+
yield { item: gr };
|
|
220
216
|
}
|
|
221
217
|
}
|
|
222
218
|
export function* iterLoadSenatCirconscriptions(dataDir, options = {}) {
|