gedcom-ts 1.1.1 → 2.0.1

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 (38) hide show
  1. package/LICENSE +22 -0
  2. package/README.md +228 -35
  3. package/dist/commons/Act.d.ts +38 -5
  4. package/dist/commons/ActsByYears.d.ts +10 -0
  5. package/dist/commons/DateAct.d.ts +24 -5
  6. package/dist/commons/MultimediaFile.d.ts +14 -0
  7. package/dist/commons/Note.d.ts +18 -0
  8. package/dist/commons/Person.d.ts +44 -0
  9. package/dist/commons/Place.d.ts +7 -9
  10. package/dist/export/GEDCOM.d.ts +46 -37
  11. package/dist/import/LoadFile.d.ts +2 -0
  12. package/dist/import/ReadGed.d.ts +17 -17
  13. package/dist/import/SplitedInformations.d.ts +13 -0
  14. package/dist/index.cjs +1 -0
  15. package/dist/index.d.ts +12 -4
  16. package/dist/index.mjs +1 -0
  17. package/dist/services/CitySearch.d.ts +2 -0
  18. package/dist/utils/acts-helper/acts-helper.d.ts +2 -0
  19. package/dist/utils/gedcom/formatNoteForExport.d.ts +12 -0
  20. package/dist/utils/gedcom/parseGedcomLine.d.ts +13 -0
  21. package/dist/utils/indi/indi.d.ts +2 -0
  22. package/dist/utils/multimedia/nextAvailableRelativeMediaPath.d.ts +9 -0
  23. package/dist/utils/sosa/calculate-sosa.d.ts +2 -0
  24. package/package.json +50 -13
  25. package/CHANGELOG.md +0 -58
  26. package/dist/commons/Act.js +0 -20
  27. package/dist/commons/DateAct.js +0 -130
  28. package/dist/commons/Identificator.enum.js +0 -132
  29. package/dist/commons/People.d.ts +0 -29
  30. package/dist/commons/People.js +0 -88
  31. package/dist/commons/Place.js +0 -24
  32. package/dist/commons/Separators.js +0 -4
  33. package/dist/commons/Utils-People.d.ts +0 -2
  34. package/dist/commons/Utils-People.js +0 -9
  35. package/dist/export/GEDCOM.js +0 -189
  36. package/dist/import/ReadGed.js +0 -92
  37. package/dist/index.js +0 -6
  38. package/webpack.config.ts +0 -28
@@ -1,92 +0,0 @@
1
- import { People, Sex } from '../commons/People';
2
- export class ReadGed {
3
- gedcom;
4
- peoples;
5
- partnersMap;
6
- childsMap;
7
- constructor(gedcom) {
8
- this.gedcom = gedcom;
9
- this.peoples = this.import();
10
- this.partnersMap = new Map();
11
- this.childsMap = new Map();
12
- this.groupPartners();
13
- }
14
- get informationHeadFile() {
15
- if (this.separate) {
16
- return this.separate.find((information) => information.startsWith('0 HEAD'));
17
- }
18
- return null;
19
- }
20
- get informationPeoplesFile() {
21
- if (this.separate) {
22
- return this.separate.filter((information) => information.startsWith('0 @I'));
23
- }
24
- return null;
25
- }
26
- get informationMarriagesFile() {
27
- if (this.separate) {
28
- return this.separate.filter((information) => information.startsWith('0 @F'));
29
- }
30
- return null;
31
- }
32
- get separate() {
33
- const splitGedcom = this.gedcom.split('\n0 ');
34
- return splitGedcom.map((split) => split.startsWith('0') ? split : `0 ${split}`);
35
- }
36
- import() {
37
- return Create.json(this.informationPeoplesFile, this.informationMarriagesFile);
38
- }
39
- groupPartners() {
40
- [...this.peoples].forEach(people => {
41
- if (people.FAMS?.length > 0) {
42
- people.FAMS.forEach(oneFams => {
43
- let partners = [people];
44
- if (this.partnersMap.has(oneFams)) {
45
- partners = [...partners, ...this.partnersMap.get(oneFams)];
46
- }
47
- this.partnersMap.set(oneFams, partners);
48
- });
49
- }
50
- if (people.FAMC) {
51
- let allChilds = [people];
52
- if (this.childsMap.has(people.FAMC)) {
53
- allChilds = [...allChilds, ...this.childsMap.get(people.FAMC)];
54
- }
55
- this.childsMap.set(people.FAMC, allChilds);
56
- }
57
- });
58
- }
59
- createDirectAncestries(people) {
60
- return this.haveParentsOfPeople(people, [])
61
- .sort((a, b) => a.sosa - b.sosa);
62
- }
63
- haveParentsOfPeople(people, directAncestries, sosaChild) {
64
- const copyPeople = Object.assign({}, people);
65
- copyPeople.sosa = !sosaChild ? 1 : (sosaChild * 2) + (people.sex === Sex.F ? 1 : 0);
66
- if (this.partnersMap.has(copyPeople.FAMC)) {
67
- const parents = [...this.partnersMap.get(copyPeople.FAMC)];
68
- if (parents && parents.length > 0) {
69
- parents.forEach(parent => {
70
- this.haveParentsOfPeople(parent, directAncestries, copyPeople.sosa);
71
- });
72
- }
73
- }
74
- directAncestries.push(copyPeople);
75
- return directAncestries;
76
- }
77
- }
78
- export 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();
85
- newPeopleJson.createPeopleJson(peopleLines);
86
- return newPeopleJson;
87
- })
88
- .sort((n1, n2) => n1.FAMC - n2.FAMC);
89
- }
90
- return null;
91
- }
92
- }
package/dist/index.js DELETED
@@ -1,6 +0,0 @@
1
- export { People, Sex } from "./commons/People";
2
- export { Act } from "./commons/Act";
3
- export { Place } from "./commons/Place";
4
- export { Identificator } from "./commons/Identificator.enum";
5
- export { GEDCOM } from "./export/GEDCOM";
6
- export { ReadGed } from "./import/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
- };