@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.
Files changed (2) hide show
  1. package/lib/loaders.js +10 -14
  2. 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 groups;
201
+ let raw;
202
202
  try {
203
- groups = fsex.readJSONSync(filePath);
203
+ raw = fsex.readJSONSync(filePath);
204
204
  }
205
205
  catch {
206
- continue;
206
+ continue; // JSON invalide
207
207
  }
208
- if (!Array.isArray(groups))
208
+ if (!raw || typeof raw !== "object")
209
209
  continue;
210
- for (const g of groups) {
211
- if (!g || typeof g !== "object")
212
- continue;
213
- const gr = g;
214
- if (!gr.date || !gr.uid || !gr.titre)
215
- continue;
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 = {}) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tricoteuses/senat",
3
- "version": "2.10.2",
3
+ "version": "2.10.3",
4
4
  "description": "Handle French Sénat's open data",
5
5
  "keywords": [
6
6
  "France",