gedcom-d3 2.0.5 → 2.0.7
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/README.md +1 -1
- package/d3ize.js +15 -7
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# gedcom-d3
|
|
2
2
|
Based on [tmcw/parse-gedcom](https://github.com/tmcw/parse-gedcom), this project seeks to improve d3ize functionality to make Gedom data in more fully-functional d3 capable JSON, specifically for use in plotting with [vasturiano/3d-force-graph](https://github.com/vasturiano/3d-force-graph).
|
|
3
3
|
|
|
4
|
-
View an implementation at [mister-blanket/
|
|
4
|
+
View an implementation at [mister-blanket/blood-lines](https://github.com/mister-blanket/blood-lines)
|
|
5
5
|
|
|
6
6
|
## Usage
|
|
7
7
|
|
package/d3ize.js
CHANGED
|
@@ -121,11 +121,11 @@ const assignFy = (peopleNodes, links) => {
|
|
|
121
121
|
|
|
122
122
|
const convertFy = (peopleNodes) => {
|
|
123
123
|
const fyRatio = peopleNodes => {
|
|
124
|
-
if (peopleNodes.length
|
|
124
|
+
if (peopleNodes.length <= 50) {
|
|
125
125
|
return 3;
|
|
126
|
-
} else if (peopleNodes.length > 50 && peopleNodes.length
|
|
126
|
+
} else if (peopleNodes.length > 50 && peopleNodes.length <= 150) {
|
|
127
127
|
return 4;
|
|
128
|
-
} else if (peopleNodes.length > 150 && peopleNodes.length
|
|
128
|
+
} else if (peopleNodes.length > 150 && peopleNodes.length <= 250) {
|
|
129
129
|
return 5;
|
|
130
130
|
} else if (peopleNodes.length > 250){
|
|
131
131
|
return 6;
|
|
@@ -218,8 +218,17 @@ const getSurname = p => {
|
|
|
218
218
|
// Derive surname from name
|
|
219
219
|
} else {
|
|
220
220
|
nameArr = nameNode.data.split(' ');
|
|
221
|
-
|
|
222
|
-
|
|
221
|
+
|
|
222
|
+
// Look for forward slashes
|
|
223
|
+
let isSlashes = nameArr.some(str => str[0] === "/");
|
|
224
|
+
if (isSlashes) {
|
|
225
|
+
return nameArr.find(str => str[0] === "/").replace(/\//g, '');
|
|
226
|
+
|
|
227
|
+
// no slashes, use final item in array
|
|
228
|
+
} else {
|
|
229
|
+
nameArr[nameArr.length -1] = nameArr[nameArr.length -1].replace(/\//g, '')
|
|
230
|
+
return nameArr.length > 1 ? nameArr[nameArr.length -1] : "Hrm"
|
|
231
|
+
}
|
|
223
232
|
}
|
|
224
233
|
} else {
|
|
225
234
|
return '?';
|
|
@@ -508,7 +517,6 @@ const getBio = (p, notes) => {
|
|
|
508
517
|
bio += personNote.data;
|
|
509
518
|
}
|
|
510
519
|
});
|
|
511
|
-
console.log(bio);
|
|
512
520
|
return bio;
|
|
513
521
|
}
|
|
514
522
|
}
|
|
@@ -549,7 +557,7 @@ const familyLinks = (family, peopleNodes) => {
|
|
|
549
557
|
|
|
550
558
|
// Filter only individual objects from family tree
|
|
551
559
|
let memberSet = family.tree.filter(function(member) {
|
|
552
|
-
return member.
|
|
560
|
+
return member.tag && (member.tag === 'HUSB' || member.tag === 'WIFE' || member.tag === 'CHIL');
|
|
553
561
|
})
|
|
554
562
|
|
|
555
563
|
// Filter marital status events
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gedcom-d3",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.7",
|
|
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/mister-blanket/kin-cloud",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|