gedcom-ts 1.1.0 → 2.0.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/LICENSE +22 -0
- package/README.md +228 -35
- package/dist/commons/Act.d.ts +38 -5
- package/dist/commons/ActsByYears.d.ts +10 -0
- package/dist/commons/DateAct.d.ts +24 -5
- package/dist/commons/MultimediaFile.d.ts +14 -0
- package/dist/commons/Note.d.ts +18 -0
- package/dist/commons/Person.d.ts +44 -0
- package/dist/commons/Place.d.ts +7 -9
- package/dist/export/GEDCOM.d.ts +46 -37
- package/dist/import/LoadFile.d.ts +2 -0
- package/dist/import/ReadGed.d.ts +17 -17
- package/dist/import/SplitedInformations.d.ts +13 -0
- package/dist/index.cjs +1 -0
- package/dist/index.d.ts +12 -4
- package/dist/index.mjs +1 -0
- package/dist/services/CitySearch.d.ts +2 -0
- package/dist/utils/acts-helper/acts-helper.d.ts +2 -0
- package/dist/utils/gedcom/formatNoteForExport.d.ts +12 -0
- package/dist/utils/gedcom/parseGedcomLine.d.ts +13 -0
- package/dist/utils/indi/indi.d.ts +2 -0
- package/dist/utils/multimedia/nextAvailableRelativeMediaPath.d.ts +9 -0
- package/dist/utils/sosa/calculate-sosa.d.ts +2 -0
- package/package.json +52 -14
- package/CHANGELOG.md +0 -58
- package/dist/commons/Act.js +0 -19
- package/dist/commons/DateAct.js +0 -128
- package/dist/commons/Identificator.enum.js +0 -134
- package/dist/commons/People.d.ts +0 -29
- package/dist/commons/People.js +0 -80
- package/dist/commons/Place.js +0 -20
- package/dist/commons/Separators.js +0 -6
- package/dist/commons/Utils-Date.d.ts +0 -6
- package/dist/commons/Utils-Date.js +0 -43
- package/dist/commons/Utils-People.d.ts +0 -2
- package/dist/commons/Utils-People.js +0 -11
- package/dist/commons/Utils.d.ts +0 -2
- package/dist/commons/Utils.js +0 -5
- package/dist/export/GEDCOM.js +0 -191
- package/dist/import/ReadGed.js +0 -93
- package/dist/index.js +0 -14
- package/webpack.config.ts +0 -28
package/dist/import/ReadGed.js
DELETED
|
@@ -1,93 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const People_1 = require("../commons/People");
|
|
4
|
-
class ReadGed {
|
|
5
|
-
constructor(gedcom) {
|
|
6
|
-
this.gedcom = gedcom;
|
|
7
|
-
this.peoples = this.import();
|
|
8
|
-
this.partnersMap = new Map();
|
|
9
|
-
this.childsMap = new Map();
|
|
10
|
-
this.groupPartners();
|
|
11
|
-
}
|
|
12
|
-
get informationHeadFile() {
|
|
13
|
-
if (this.separate) {
|
|
14
|
-
return this.separate.find((information) => information.startsWith('0 HEAD'));
|
|
15
|
-
}
|
|
16
|
-
return null;
|
|
17
|
-
}
|
|
18
|
-
get informationPeoplesFile() {
|
|
19
|
-
if (this.separate) {
|
|
20
|
-
return this.separate.filter((information) => information.startsWith('0 @I'));
|
|
21
|
-
}
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
get informationMarriagesFile() {
|
|
25
|
-
if (this.separate) {
|
|
26
|
-
return this.separate.filter((information) => information.startsWith('0 @F'));
|
|
27
|
-
}
|
|
28
|
-
return null;
|
|
29
|
-
}
|
|
30
|
-
get separate() {
|
|
31
|
-
const splitGedcom = this.gedcom.split('\n0 ');
|
|
32
|
-
return splitGedcom.map((split) => split.startsWith('0') ? split : `0 ${split}`);
|
|
33
|
-
}
|
|
34
|
-
import() {
|
|
35
|
-
return Create.json(this.informationPeoplesFile, this.informationMarriagesFile);
|
|
36
|
-
}
|
|
37
|
-
groupPartners() {
|
|
38
|
-
[...this.peoples].forEach(people => {
|
|
39
|
-
var _a;
|
|
40
|
-
if (((_a = people.FAMS) === null || _a === void 0 ? void 0 : _a.length) > 0) {
|
|
41
|
-
people.FAMS.forEach(oneFams => {
|
|
42
|
-
let partners = [people];
|
|
43
|
-
if (this.partnersMap.has(oneFams)) {
|
|
44
|
-
partners = [...partners, ...this.partnersMap.get(oneFams)];
|
|
45
|
-
}
|
|
46
|
-
this.partnersMap.set(oneFams, partners);
|
|
47
|
-
});
|
|
48
|
-
}
|
|
49
|
-
if (people.FAMC) {
|
|
50
|
-
let allChilds = [people];
|
|
51
|
-
if (this.childsMap.has(people.FAMC)) {
|
|
52
|
-
allChilds = [...allChilds, ...this.childsMap.get(people.FAMC)];
|
|
53
|
-
}
|
|
54
|
-
this.childsMap.set(people.FAMC, allChilds);
|
|
55
|
-
}
|
|
56
|
-
});
|
|
57
|
-
}
|
|
58
|
-
createDirectAncestries(people) {
|
|
59
|
-
return this.haveParentsOfPeople(people, [])
|
|
60
|
-
.sort((a, b) => a.sosa - b.sosa);
|
|
61
|
-
}
|
|
62
|
-
haveParentsOfPeople(people, directAncestries, sosaChild) {
|
|
63
|
-
const copyPeople = Object.assign({}, people);
|
|
64
|
-
copyPeople.sosa = !sosaChild ? 1 : (sosaChild * 2) + (people.sex === People_1.Sex.F ? 1 : 0);
|
|
65
|
-
if (this.partnersMap.has(copyPeople.FAMC)) {
|
|
66
|
-
const parents = [...this.partnersMap.get(copyPeople.FAMC)];
|
|
67
|
-
if (parents && parents.length > 0) {
|
|
68
|
-
parents.forEach(parent => {
|
|
69
|
-
this.haveParentsOfPeople(parent, directAncestries, copyPeople.sosa);
|
|
70
|
-
});
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
directAncestries.push(copyPeople);
|
|
74
|
-
return directAncestries;
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
exports.ReadGed = ReadGed;
|
|
78
|
-
class Create {
|
|
79
|
-
static json(peoplesFile, marriagesFile) {
|
|
80
|
-
if (peoplesFile && peoplesFile.length > 0) {
|
|
81
|
-
return peoplesFile
|
|
82
|
-
.map((peopleFile) => {
|
|
83
|
-
const peopleLines = peopleFile.split('\n');
|
|
84
|
-
const newPeopleJson = new People_1.People();
|
|
85
|
-
newPeopleJson.createPeopleJson(peopleLines);
|
|
86
|
-
return newPeopleJson;
|
|
87
|
-
})
|
|
88
|
-
.sort((n1, n2) => n1.FAMC - n2.FAMC);
|
|
89
|
-
}
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
exports.Create = Create;
|
package/dist/index.js
DELETED
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
var People_1 = require("./commons/People");
|
|
4
|
-
exports.People = People_1.People;
|
|
5
|
-
var Act_1 = require("./commons/Act");
|
|
6
|
-
exports.Act = Act_1.Act;
|
|
7
|
-
var Place_1 = require("./commons/Place");
|
|
8
|
-
exports.Place = Place_1.Place;
|
|
9
|
-
var Identificator_enum_1 = require("./commons/Identificator.enum");
|
|
10
|
-
exports.Identificator = Identificator_enum_1.Identificator;
|
|
11
|
-
var GEDCOM_1 = require("./export/GEDCOM");
|
|
12
|
-
exports.GEDCOM = GEDCOM_1.GEDCOM;
|
|
13
|
-
var ReadGed_1 = require("./import/ReadGed");
|
|
14
|
-
exports.ReadGed = ReadGed_1.ReadGed;
|
package/webpack.config.ts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
const path = require('path');
|
|
2
|
-
|
|
3
|
-
module.exports = {
|
|
4
|
-
entry: './src/index.ts',
|
|
5
|
-
devtool: 'inline-source-map',
|
|
6
|
-
module: {
|
|
7
|
-
rules: [
|
|
8
|
-
{
|
|
9
|
-
test: /\.tsx?$/,
|
|
10
|
-
use: 'ts-loader',
|
|
11
|
-
exclude: /node_modules/,
|
|
12
|
-
},
|
|
13
|
-
],
|
|
14
|
-
},
|
|
15
|
-
resolve: {
|
|
16
|
-
extensions: [ '.tsx', '.ts', '.js' ],
|
|
17
|
-
},
|
|
18
|
-
output: {
|
|
19
|
-
filename: 'bundle.js',
|
|
20
|
-
path: path.resolve(__dirname, 'dist'),
|
|
21
|
-
},
|
|
22
|
-
node: {
|
|
23
|
-
console: 'empty',
|
|
24
|
-
fs: 'empty',
|
|
25
|
-
net: 'empty',
|
|
26
|
-
tls: 'empty'
|
|
27
|
-
}
|
|
28
|
-
};
|