gedcom-d3 2.3.0 → 2.9.0
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/.claude/settings.local.json +8 -1
- package/d3ize.js +37 -34
- package/package.json +2 -2
|
@@ -2,7 +2,14 @@
|
|
|
2
2
|
"permissions": {
|
|
3
3
|
"allow": [
|
|
4
4
|
"Bash(chmod:*)",
|
|
5
|
-
"Bash(./publish.sh:*)"
|
|
5
|
+
"Bash(./publish.sh:*)",
|
|
6
|
+
"Bash(while read hash msg)",
|
|
7
|
+
"Bash(do echo \"=== $msg \\($hash\\) ===\")",
|
|
8
|
+
"Bash(done)",
|
|
9
|
+
"Bash(npm run release:*)",
|
|
10
|
+
"Bash(npm whoami:*)",
|
|
11
|
+
"Bash(npm login:*)",
|
|
12
|
+
"Bash(npm publish:*)"
|
|
6
13
|
]
|
|
7
14
|
}
|
|
8
15
|
}
|
package/d3ize.js
CHANGED
|
@@ -191,6 +191,14 @@ const getFirstName = (p) => {
|
|
|
191
191
|
return firstNameNode.data;
|
|
192
192
|
}
|
|
193
193
|
} else {
|
|
194
|
+
// Fallback: extract given name from NAME value (e.g. "Harry /Potter/")
|
|
195
|
+
const nameData = nameNode.data || "";
|
|
196
|
+
const slashIndex = nameData.indexOf("/");
|
|
197
|
+
const givenPart = (slashIndex !== -1 ? nameData.slice(0, slashIndex) : nameData).trim();
|
|
198
|
+
if (givenPart) {
|
|
199
|
+
const spaceIndex = givenPart.indexOf(" ");
|
|
200
|
+
return spaceIndex !== -1 ? givenPart.slice(0, spaceIndex) : givenPart;
|
|
201
|
+
}
|
|
194
202
|
return "?";
|
|
195
203
|
}
|
|
196
204
|
} else {
|
|
@@ -245,7 +253,7 @@ const getGender = (p) => {
|
|
|
245
253
|
if (genderNode) {
|
|
246
254
|
return genderNode.data;
|
|
247
255
|
} else {
|
|
248
|
-
return "
|
|
256
|
+
return "U";
|
|
249
257
|
}
|
|
250
258
|
};
|
|
251
259
|
|
|
@@ -266,6 +274,12 @@ const getDOB = (p) => {
|
|
|
266
274
|
}
|
|
267
275
|
};
|
|
268
276
|
|
|
277
|
+
// Extract a 4-digit year from a date string
|
|
278
|
+
const extractYear = (dateStr) => {
|
|
279
|
+
const match = dateStr.match(/\b(\d{4})\b/);
|
|
280
|
+
return match ? match[1] : "?";
|
|
281
|
+
};
|
|
282
|
+
|
|
269
283
|
// Get year of birth
|
|
270
284
|
const getYOB = (p) => {
|
|
271
285
|
// Find 'BIRT' tag
|
|
@@ -274,7 +288,7 @@ const getYOB = (p) => {
|
|
|
274
288
|
// Find 'DATE' tag
|
|
275
289
|
let dateNode = (dobNode.tree.filter(hasTag("DATE")) || [])[0];
|
|
276
290
|
if (dateNode) {
|
|
277
|
-
return dateNode.data
|
|
291
|
+
return extractYear(dateNode.data);
|
|
278
292
|
} else {
|
|
279
293
|
return "?";
|
|
280
294
|
}
|
|
@@ -303,7 +317,6 @@ const getPOB = (p) => {
|
|
|
303
317
|
// Get date of death
|
|
304
318
|
const getDOD = (p) => {
|
|
305
319
|
// Find 'DEAT' tag
|
|
306
|
-
let dobNode = (p.tree.filter(hasTag("BIRT")) || [])[0];
|
|
307
320
|
let dodNode = (p.tree.filter(hasTag("DEAT")) || [])[0];
|
|
308
321
|
if (dodNode) {
|
|
309
322
|
// Find 'DATE' tag
|
|
@@ -313,15 +326,8 @@ const getDOD = (p) => {
|
|
|
313
326
|
} else {
|
|
314
327
|
return "?";
|
|
315
328
|
}
|
|
316
|
-
} else if (dobNode) {
|
|
317
|
-
let dateNode = (dobNode.tree.filter(hasTag("DATE")) || [])[0];
|
|
318
|
-
if (dateNode) {
|
|
319
|
-
return dateNode.data.slice(-4) + 100;
|
|
320
|
-
} else {
|
|
321
|
-
return "?";
|
|
322
|
-
}
|
|
323
329
|
} else {
|
|
324
|
-
return "
|
|
330
|
+
return "?";
|
|
325
331
|
}
|
|
326
332
|
};
|
|
327
333
|
|
|
@@ -340,7 +346,7 @@ const getYOD = (p) => {
|
|
|
340
346
|
|
|
341
347
|
// If death date listed
|
|
342
348
|
if (dateNode) {
|
|
343
|
-
return dateNode.data
|
|
349
|
+
return extractYear(dateNode.data);
|
|
344
350
|
} else {
|
|
345
351
|
return "?";
|
|
346
352
|
}
|
|
@@ -352,7 +358,8 @@ const getYOD = (p) => {
|
|
|
352
358
|
// If DOB listed
|
|
353
359
|
if (dateNode) {
|
|
354
360
|
// If born > 100 yrs ago, call dead
|
|
355
|
-
|
|
361
|
+
let birthYear = extractYear(dateNode.data);
|
|
362
|
+
if (birthYear !== "?" && Number(birthYear) < thisYear - 100) {
|
|
356
363
|
return "?";
|
|
357
364
|
} else {
|
|
358
365
|
return "Present";
|
|
@@ -423,35 +430,31 @@ const getFamilies = (p) => {
|
|
|
423
430
|
const getColor = (p, surnameList) => {
|
|
424
431
|
const colorList = [
|
|
425
432
|
"#f6edd0", // cream
|
|
426
|
-
"#
|
|
427
|
-
"#
|
|
428
|
-
"#
|
|
429
|
-
"#
|
|
430
|
-
"#e1b386", // light brown
|
|
431
|
-
"#a5c2cc", // light blue grey
|
|
432
|
-
"#e87c76", // soft pink
|
|
433
|
+
"#f8a39e", // soft pink
|
|
434
|
+
"#5bceff", // sky blue
|
|
435
|
+
"#ffc32a", // mexican egg yolk
|
|
436
|
+
"#8df0c2", // grass & sage
|
|
433
437
|
"#d0a8ec", // soft royal purple
|
|
434
|
-
"#
|
|
435
|
-
"#
|
|
438
|
+
"#ffa686", // coral
|
|
439
|
+
"#adcdd8", // light blue grey
|
|
440
|
+
"#a6b890", // olive sage
|
|
441
|
+
"#e6f387", // olive
|
|
442
|
+
"#eebf90", // light brown
|
|
436
443
|
"#6e90e6", // ligt purple blue
|
|
437
|
-
"#
|
|
438
|
-
"#
|
|
439
|
-
"#
|
|
444
|
+
"#f8a7d0", // dry wine
|
|
445
|
+
"#30f6d5", // sea foam
|
|
446
|
+
"#be719d", // magenta
|
|
440
447
|
"#e08e79", // blush
|
|
441
448
|
"#80d152", // neon green
|
|
442
|
-
"#
|
|
443
|
-
"#7ff0ca", // light sea foam
|
|
449
|
+
"#9efde5", // light sea foam
|
|
444
450
|
"#ff835a", // burnt orange
|
|
445
451
|
"#eebd6e", // chocolate
|
|
446
|
-
"#
|
|
447
|
-
"#
|
|
448
|
-
"#e8b28e", // peach
|
|
452
|
+
"#35f8a0", // forest
|
|
453
|
+
"#f95162", // rouge
|
|
449
454
|
"#d4ee5e", // lime
|
|
450
|
-
"#f3f621", // light yellow
|
|
451
455
|
"#e887aa", // newborn pink
|
|
452
|
-
"#
|
|
453
|
-
"#
|
|
454
|
-
"#ccc", // light grey
|
|
456
|
+
"#a178ea", // royal purple
|
|
457
|
+
"#00c0de", // baby foam
|
|
455
458
|
];
|
|
456
459
|
|
|
457
460
|
// If color description listed in GEDCOM
|
package/package.json
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gedcom-d3",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.9.0",
|
|
4
4
|
"description": "A GEDCOM parser, which translates GEDCOM (.ged) files into D3 capable JSON. This package is specifically designed to prepare data for use in https://github.com/oh-kay-blanket/blood-lines",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
7
7
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
8
|
-
"
|
|
8
|
+
"release": "./publish.sh minor"
|
|
9
9
|
},
|
|
10
10
|
"keywords": [
|
|
11
11
|
"gedcom",
|