@treeviz/gedcom-parser 1.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 (321) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +954 -0
  3. package/dist/classes/common.d.ts +87 -0
  4. package/dist/classes/common.d.ts.map +1 -0
  5. package/dist/classes/common.js +481 -0
  6. package/dist/classes/date.d.ts +26 -0
  7. package/dist/classes/date.d.ts.map +1 -0
  8. package/dist/classes/date.js +176 -0
  9. package/dist/classes/fam.d.ts +19 -0
  10. package/dist/classes/fam.d.ts.map +1 -0
  11. package/dist/classes/fam.js +38 -0
  12. package/dist/classes/fams.d.ts +16 -0
  13. package/dist/classes/fams.d.ts.map +1 -0
  14. package/dist/classes/fams.js +41 -0
  15. package/dist/classes/gedcom.d.ts +89 -0
  16. package/dist/classes/gedcom.d.ts.map +1 -0
  17. package/dist/classes/gedcom.js +421 -0
  18. package/dist/classes/index.d.ts +19 -0
  19. package/dist/classes/index.d.ts.map +1 -0
  20. package/dist/classes/index.js +19 -0
  21. package/dist/classes/indi.d.ts +298 -0
  22. package/dist/classes/indi.d.ts.map +1 -0
  23. package/dist/classes/indi.js +2049 -0
  24. package/dist/classes/indis.d.ts +54 -0
  25. package/dist/classes/indis.d.ts.map +1 -0
  26. package/dist/classes/indis.js +439 -0
  27. package/dist/classes/list.d.ts +55 -0
  28. package/dist/classes/list.d.ts.map +1 -0
  29. package/dist/classes/list.js +440 -0
  30. package/dist/classes/name.d.ts +20 -0
  31. package/dist/classes/name.d.ts.map +1 -0
  32. package/dist/classes/name.js +48 -0
  33. package/dist/classes/note.d.ts +12 -0
  34. package/dist/classes/note.d.ts.map +1 -0
  35. package/dist/classes/note.js +46 -0
  36. package/dist/classes/obje.d.ts +12 -0
  37. package/dist/classes/obje.d.ts.map +1 -0
  38. package/dist/classes/obje.js +81 -0
  39. package/dist/classes/objes.d.ts +8 -0
  40. package/dist/classes/objes.d.ts.map +1 -0
  41. package/dist/classes/objes.js +13 -0
  42. package/dist/classes/repo.d.ts +11 -0
  43. package/dist/classes/repo.d.ts.map +1 -0
  44. package/dist/classes/repo.js +6 -0
  45. package/dist/classes/repos.d.ts +8 -0
  46. package/dist/classes/repos.d.ts.map +1 -0
  47. package/dist/classes/repos.js +13 -0
  48. package/dist/classes/sour.d.ts +11 -0
  49. package/dist/classes/sour.d.ts.map +1 -0
  50. package/dist/classes/sour.js +6 -0
  51. package/dist/classes/sours.d.ts +8 -0
  52. package/dist/classes/sours.d.ts.map +1 -0
  53. package/dist/classes/sours.js +13 -0
  54. package/dist/classes/subm.d.ts +10 -0
  55. package/dist/classes/subm.d.ts.map +1 -0
  56. package/dist/classes/subm.js +6 -0
  57. package/dist/classes/subms.d.ts +8 -0
  58. package/dist/classes/subms.d.ts.map +1 -0
  59. package/dist/classes/subms.js +13 -0
  60. package/dist/constants/constants.d.ts +14 -0
  61. package/dist/constants/constants.d.ts.map +1 -0
  62. package/dist/constants/constants.js +13 -0
  63. package/dist/constants/filters.d.ts +17 -0
  64. package/dist/constants/filters.d.ts.map +1 -0
  65. package/dist/constants/filters.js +44 -0
  66. package/dist/constants/index.d.ts +4 -0
  67. package/dist/constants/index.d.ts.map +1 -0
  68. package/dist/constants/index.js +4 -0
  69. package/dist/constants/orders.d.ts +17 -0
  70. package/dist/constants/orders.d.ts.map +1 -0
  71. package/dist/constants/orders.js +240 -0
  72. package/dist/factories/cache-factory.d.ts +30 -0
  73. package/dist/factories/cache-factory.d.ts.map +1 -0
  74. package/dist/factories/cache-factory.js +43 -0
  75. package/dist/factories/date-locale-factory.d.ts +30 -0
  76. package/dist/factories/date-locale-factory.d.ts.map +1 -0
  77. package/dist/factories/date-locale-factory.js +34 -0
  78. package/dist/factories/i18n-factory.d.ts +40 -0
  79. package/dist/factories/i18n-factory.d.ts.map +1 -0
  80. package/dist/factories/i18n-factory.js +44 -0
  81. package/dist/factories/index.d.ts +5 -0
  82. package/dist/factories/index.d.ts.map +1 -0
  83. package/dist/factories/index.js +5 -0
  84. package/dist/factories/kinship-factory.d.ts +38 -0
  85. package/dist/factories/kinship-factory.d.ts.map +1 -0
  86. package/dist/factories/kinship-factory.js +35 -0
  87. package/dist/factories/place-parser-provider.d.ts +32 -0
  88. package/dist/factories/place-parser-provider.d.ts.map +1 -0
  89. package/dist/factories/place-parser-provider.js +35 -0
  90. package/dist/factories/place-translator-provider.d.ts +32 -0
  91. package/dist/factories/place-translator-provider.d.ts.map +1 -0
  92. package/dist/factories/place-translator-provider.js +35 -0
  93. package/dist/index.d.ts +78 -0
  94. package/dist/index.d.ts.map +1 -0
  95. package/dist/index.js +44 -0
  96. package/dist/interfaces/common.d.ts +43 -0
  97. package/dist/interfaces/common.d.ts.map +1 -0
  98. package/dist/interfaces/common.js +1 -0
  99. package/dist/interfaces/fam.d.ts +11 -0
  100. package/dist/interfaces/fam.d.ts.map +1 -0
  101. package/dist/interfaces/fam.js +1 -0
  102. package/dist/interfaces/fams.d.ts +9 -0
  103. package/dist/interfaces/fams.d.ts.map +1 -0
  104. package/dist/interfaces/fams.js +1 -0
  105. package/dist/interfaces/gedcom.d.ts +30 -0
  106. package/dist/interfaces/gedcom.d.ts.map +1 -0
  107. package/dist/interfaces/gedcom.js +1 -0
  108. package/dist/interfaces/index.d.ts +12 -0
  109. package/dist/interfaces/index.d.ts.map +1 -0
  110. package/dist/interfaces/index.js +1 -0
  111. package/dist/interfaces/indi.d.ts +109 -0
  112. package/dist/interfaces/indi.d.ts.map +1 -0
  113. package/dist/interfaces/indi.js +1 -0
  114. package/dist/interfaces/indis.d.ts +31 -0
  115. package/dist/interfaces/indis.d.ts.map +1 -0
  116. package/dist/interfaces/indis.js +1 -0
  117. package/dist/interfaces/list.d.ts +52 -0
  118. package/dist/interfaces/list.d.ts.map +1 -0
  119. package/dist/interfaces/list.js +1 -0
  120. package/dist/interfaces/obje.d.ts +7 -0
  121. package/dist/interfaces/obje.d.ts.map +1 -0
  122. package/dist/interfaces/obje.js +1 -0
  123. package/dist/interfaces/repo.d.ts +7 -0
  124. package/dist/interfaces/repo.d.ts.map +1 -0
  125. package/dist/interfaces/repo.js +1 -0
  126. package/dist/interfaces/sour.d.ts +7 -0
  127. package/dist/interfaces/sour.d.ts.map +1 -0
  128. package/dist/interfaces/sour.js +1 -0
  129. package/dist/interfaces/subm.d.ts +6 -0
  130. package/dist/interfaces/subm.d.ts.map +1 -0
  131. package/dist/interfaces/subm.js +1 -0
  132. package/dist/kinship-translator/index.d.ts +11 -0
  133. package/dist/kinship-translator/index.d.ts.map +1 -0
  134. package/dist/kinship-translator/index.js +10 -0
  135. package/dist/kinship-translator/kinship-translator.basic.d.ts +30 -0
  136. package/dist/kinship-translator/kinship-translator.basic.d.ts.map +1 -0
  137. package/dist/kinship-translator/kinship-translator.basic.js +74 -0
  138. package/dist/kinship-translator/kinship-translator.d.ts +26 -0
  139. package/dist/kinship-translator/kinship-translator.d.ts.map +1 -0
  140. package/dist/kinship-translator/kinship-translator.de.d.ts +18 -0
  141. package/dist/kinship-translator/kinship-translator.de.d.ts.map +1 -0
  142. package/dist/kinship-translator/kinship-translator.de.js +180 -0
  143. package/dist/kinship-translator/kinship-translator.en.d.ts +18 -0
  144. package/dist/kinship-translator/kinship-translator.en.d.ts.map +1 -0
  145. package/dist/kinship-translator/kinship-translator.en.js +182 -0
  146. package/dist/kinship-translator/kinship-translator.es.d.ts +18 -0
  147. package/dist/kinship-translator/kinship-translator.es.d.ts.map +1 -0
  148. package/dist/kinship-translator/kinship-translator.es.js +181 -0
  149. package/dist/kinship-translator/kinship-translator.fr.d.ts +18 -0
  150. package/dist/kinship-translator/kinship-translator.fr.d.ts.map +1 -0
  151. package/dist/kinship-translator/kinship-translator.fr.js +181 -0
  152. package/dist/kinship-translator/kinship-translator.hu.d.ts +19 -0
  153. package/dist/kinship-translator/kinship-translator.hu.d.ts.map +1 -0
  154. package/dist/kinship-translator/kinship-translator.hu.js +226 -0
  155. package/dist/kinship-translator/kinship-translator.interface.d.ts +19 -0
  156. package/dist/kinship-translator/kinship-translator.interface.d.ts.map +1 -0
  157. package/dist/kinship-translator/kinship-translator.interface.js +1 -0
  158. package/dist/kinship-translator/kinship-translator.js +103 -0
  159. package/dist/kinship-translator/patterns.de.d.ts +2 -0
  160. package/dist/kinship-translator/patterns.de.d.ts.map +1 -0
  161. package/dist/kinship-translator/patterns.de.js +14 -0
  162. package/dist/kinship-translator/patterns.en.d.ts +2 -0
  163. package/dist/kinship-translator/patterns.en.d.ts.map +1 -0
  164. package/dist/kinship-translator/patterns.en.js +14 -0
  165. package/dist/kinship-translator/patterns.es.d.ts +2 -0
  166. package/dist/kinship-translator/patterns.es.d.ts.map +1 -0
  167. package/dist/kinship-translator/patterns.es.js +14 -0
  168. package/dist/kinship-translator/patterns.fr.d.ts +2 -0
  169. package/dist/kinship-translator/patterns.fr.d.ts.map +1 -0
  170. package/dist/kinship-translator/patterns.fr.js +14 -0
  171. package/dist/kinship-translator/patterns.hu.d.ts +6 -0
  172. package/dist/kinship-translator/patterns.hu.d.ts.map +1 -0
  173. package/dist/kinship-translator/patterns.hu.js +97 -0
  174. package/dist/kinship-translator/translators.d.ts +6 -0
  175. package/dist/kinship-translator/translators.d.ts.map +1 -0
  176. package/dist/kinship-translator/translators.js +5 -0
  177. package/dist/kinship-translator/types.d.ts +9 -0
  178. package/dist/kinship-translator/types.d.ts.map +1 -0
  179. package/dist/kinship-translator/types.js +1 -0
  180. package/dist/structures/address.d.ts +14 -0
  181. package/dist/structures/address.d.ts.map +1 -0
  182. package/dist/structures/address.js +1 -0
  183. package/dist/structures/association.d.ts +13 -0
  184. package/dist/structures/association.d.ts.map +1 -0
  185. package/dist/structures/association.js +1 -0
  186. package/dist/structures/change-date.d.ts +8 -0
  187. package/dist/structures/change-date.d.ts.map +1 -0
  188. package/dist/structures/change-date.js +1 -0
  189. package/dist/structures/creation-date.d.ts +7 -0
  190. package/dist/structures/creation-date.d.ts.map +1 -0
  191. package/dist/structures/creation-date.js +1 -0
  192. package/dist/structures/date.d.ts +9 -0
  193. package/dist/structures/date.d.ts.map +1 -0
  194. package/dist/structures/date.js +1 -0
  195. package/dist/structures/event-detail-structure.d.ts +25 -0
  196. package/dist/structures/event-detail-structure.d.ts.map +1 -0
  197. package/dist/structures/event-detail-structure.js +1 -0
  198. package/dist/structures/family.d.ts +34 -0
  199. package/dist/structures/family.d.ts.map +1 -0
  200. package/dist/structures/family.js +1 -0
  201. package/dist/structures/gedcom.d.ts +60 -0
  202. package/dist/structures/gedcom.d.ts.map +1 -0
  203. package/dist/structures/gedcom.js +1 -0
  204. package/dist/structures/index.d.ts +25 -0
  205. package/dist/structures/index.d.ts.map +1 -0
  206. package/dist/structures/index.js +1 -0
  207. package/dist/structures/individual-event-detail-structure.d.ts +9 -0
  208. package/dist/structures/individual-event-detail-structure.d.ts.map +1 -0
  209. package/dist/structures/individual-event-detail-structure.js +1 -0
  210. package/dist/structures/individual-event-structure.d.ts +83 -0
  211. package/dist/structures/individual-event-structure.d.ts.map +1 -0
  212. package/dist/structures/individual-event-structure.js +1 -0
  213. package/dist/structures/individual.d.ts +40 -0
  214. package/dist/structures/individual.d.ts.map +1 -0
  215. package/dist/structures/individual.js +1 -0
  216. package/dist/structures/lds-ordinance-detail.d.ts +17 -0
  217. package/dist/structures/lds-ordinance-detail.d.ts.map +1 -0
  218. package/dist/structures/lds-ordinance-detail.js +1 -0
  219. package/dist/structures/lds-spouse-sealing.d.ts +7 -0
  220. package/dist/structures/lds-spouse-sealing.d.ts.map +1 -0
  221. package/dist/structures/lds-spouse-sealing.js +1 -0
  222. package/dist/structures/marriage-date.d.ts +11 -0
  223. package/dist/structures/marriage-date.d.ts.map +1 -0
  224. package/dist/structures/marriage-date.js +1 -0
  225. package/dist/structures/multimedia-link.d.ts +16 -0
  226. package/dist/structures/multimedia-link.d.ts.map +1 -0
  227. package/dist/structures/multimedia-link.js +1 -0
  228. package/dist/structures/non-event.d.ts +12 -0
  229. package/dist/structures/non-event.d.ts.map +1 -0
  230. package/dist/structures/non-event.js +1 -0
  231. package/dist/structures/note.d.ts +16 -0
  232. package/dist/structures/note.d.ts.map +1 -0
  233. package/dist/structures/note.js +1 -0
  234. package/dist/structures/personal-name-pieces.d.ts +11 -0
  235. package/dist/structures/personal-name-pieces.d.ts.map +1 -0
  236. package/dist/structures/personal-name-pieces.js +1 -0
  237. package/dist/structures/personal-name.d.ts +16 -0
  238. package/dist/structures/personal-name.d.ts.map +1 -0
  239. package/dist/structures/personal-name.js +1 -0
  240. package/dist/structures/place.d.ts +20 -0
  241. package/dist/structures/place.d.ts.map +1 -0
  242. package/dist/structures/place.js +1 -0
  243. package/dist/structures/repository.d.ts +6 -0
  244. package/dist/structures/repository.d.ts.map +1 -0
  245. package/dist/structures/repository.js +1 -0
  246. package/dist/structures/source-citation.d.ts +27 -0
  247. package/dist/structures/source-citation.d.ts.map +1 -0
  248. package/dist/structures/source-citation.js +1 -0
  249. package/dist/structures/source-repository-citation.d.ts +13 -0
  250. package/dist/structures/source-repository-citation.d.ts.map +1 -0
  251. package/dist/structures/source-repository-citation.js +1 -0
  252. package/dist/structures/source.d.ts +28 -0
  253. package/dist/structures/source.d.ts.map +1 -0
  254. package/dist/structures/source.js +1 -0
  255. package/dist/types/ancestry-media.d.ts +65 -0
  256. package/dist/types/ancestry-media.d.ts.map +1 -0
  257. package/dist/types/ancestry-media.js +1 -0
  258. package/dist/types/index.d.ts +4 -0
  259. package/dist/types/index.d.ts.map +1 -0
  260. package/dist/types/index.js +4 -0
  261. package/dist/types/settings.d.ts +12 -0
  262. package/dist/types/settings.d.ts.map +1 -0
  263. package/dist/types/settings.js +1 -0
  264. package/dist/types/types.d.ts +220 -0
  265. package/dist/types/types.d.ts.map +1 -0
  266. package/dist/types/types.js +26 -0
  267. package/dist/utils/cache.d.ts +22 -0
  268. package/dist/utils/cache.d.ts.map +1 -0
  269. package/dist/utils/cache.js +57 -0
  270. package/dist/utils/common-creator.d.ts +13 -0
  271. package/dist/utils/common-creator.d.ts.map +1 -0
  272. package/dist/utils/common-creator.js +72 -0
  273. package/dist/utils/date-formatter.d.ts +35 -0
  274. package/dist/utils/date-formatter.d.ts.map +1 -0
  275. package/dist/utils/date-formatter.js +207 -0
  276. package/dist/utils/get-all-prop.d.ts +4 -0
  277. package/dist/utils/get-all-prop.d.ts.map +1 -0
  278. package/dist/utils/get-all-prop.js +5 -0
  279. package/dist/utils/get-family-with.d.ts +5 -0
  280. package/dist/utils/get-family-with.d.ts.map +1 -0
  281. package/dist/utils/get-family-with.js +11 -0
  282. package/dist/utils/get-places.d.ts +21 -0
  283. package/dist/utils/get-places.d.ts.map +1 -0
  284. package/dist/utils/get-places.js +77 -0
  285. package/dist/utils/get-product-details.d.ts +4 -0
  286. package/dist/utils/get-product-details.d.ts.map +1 -0
  287. package/dist/utils/get-product-details.js +6 -0
  288. package/dist/utils/get-raw-size.d.ts +2 -0
  289. package/dist/utils/get-raw-size.d.ts.map +1 -0
  290. package/dist/utils/get-raw-size.js +3 -0
  291. package/dist/utils/index.d.ts +17 -0
  292. package/dist/utils/index.d.ts.map +1 -0
  293. package/dist/utils/index.js +18 -0
  294. package/dist/utils/logger.d.ts +3 -0
  295. package/dist/utils/logger.d.ts.map +1 -0
  296. package/dist/utils/logger.js +11 -0
  297. package/dist/utils/name-formatter.d.ts +10 -0
  298. package/dist/utils/name-formatter.d.ts.map +1 -0
  299. package/dist/utils/name-formatter.js +45 -0
  300. package/dist/utils/nested-group.d.ts +4 -0
  301. package/dist/utils/nested-group.d.ts.map +1 -0
  302. package/dist/utils/nested-group.js +34 -0
  303. package/dist/utils/ordinalize.d.ts +3 -0
  304. package/dist/utils/ordinalize.d.ts.map +1 -0
  305. package/dist/utils/ordinalize.js +104 -0
  306. package/dist/utils/parser.d.ts +17 -0
  307. package/dist/utils/parser.d.ts.map +1 -0
  308. package/dist/utils/parser.js +322 -0
  309. package/dist/utils/place-parser.d.ts +16 -0
  310. package/dist/utils/place-parser.d.ts.map +1 -0
  311. package/dist/utils/place-parser.js +46 -0
  312. package/dist/utils/place-translator.d.ts +6 -0
  313. package/dist/utils/place-translator.d.ts.map +1 -0
  314. package/dist/utils/place-translator.js +8 -0
  315. package/dist/utils/place-types.d.ts +27 -0
  316. package/dist/utils/place-types.d.ts.map +1 -0
  317. package/dist/utils/place-types.js +14 -0
  318. package/dist/utils/range.d.ts +19 -0
  319. package/dist/utils/range.d.ts.map +1 -0
  320. package/dist/utils/range.js +265 -0
  321. package/package.json +153 -0
@@ -0,0 +1,180 @@
1
+ import { nameFormatter } from "../utils/name-formatter";
2
+ import KinshipTranslatorBasic from "./kinship-translator.basic";
3
+ import { InLawsDe } from "./patterns.de";
4
+ export default class KinshipTranslatorDe extends KinshipTranslatorBasic {
5
+ directPrefix() {
6
+ const level = Math.abs(this.pathN?.level ?? 0);
7
+ if (level <= 1) {
8
+ return "";
9
+ }
10
+ if (level === 2) {
11
+ return "Groß";
12
+ }
13
+ if (level === 3) {
14
+ return "Urgroß";
15
+ }
16
+ return `Ur${level - 2}-groß`;
17
+ }
18
+ indirect() {
19
+ let degree = Math.abs(this.pathN?.degree ?? 0);
20
+ if (degree > 0) {
21
+ degree = degree - 1;
22
+ }
23
+ if (degree === 1) {
24
+ return `Cousin`;
25
+ }
26
+ return `Cousin ${degree}. Grades`;
27
+ }
28
+ removal() {
29
+ const level = this.pathN?.level ?? 0;
30
+ let degree = Math.abs(this.pathN?.degree ?? 0);
31
+ if (degree > 0) {
32
+ degree = degree - 1;
33
+ }
34
+ if (!degree) {
35
+ return level < 0 ? this.nibling() : this.auncle();
36
+ }
37
+ return `Cousin ${degree}. Grades ${Math.abs(level)}× entfernt`;
38
+ }
39
+ auncle() {
40
+ const prefix = this.directPrefix();
41
+ if (this.personN?.isMale()) {
42
+ return `${prefix}onkel`;
43
+ }
44
+ if (this.personN?.isFemale()) {
45
+ return `${prefix}tante`;
46
+ }
47
+ return `${prefix}onkel/tante`;
48
+ }
49
+ nibling() {
50
+ const prefix = this.directPrefix();
51
+ if (this.personN?.isMale()) {
52
+ return `${prefix}neffe`;
53
+ }
54
+ if (this.personN?.isFemale()) {
55
+ return `${prefix}nichte`;
56
+ }
57
+ return `${prefix}neffe/nichte`;
58
+ }
59
+ parent() {
60
+ const prefix = this.directPrefix();
61
+ if (this.personN?.isMale()) {
62
+ return `${prefix}vater`;
63
+ }
64
+ if (this.personN?.isFemale()) {
65
+ return `${prefix}mutter`;
66
+ }
67
+ return `${prefix}elternteil`;
68
+ }
69
+ child() {
70
+ const prefix = this.directPrefix();
71
+ if (this.personN?.isMale()) {
72
+ return `${prefix}sohn`;
73
+ }
74
+ if (this.personN?.isFemale()) {
75
+ return `${prefix}tochter`;
76
+ }
77
+ return `${prefix}kind`;
78
+ }
79
+ sibling() {
80
+ const parents1 = this.person1?.getBiologicalParents();
81
+ const parentsN = this.personN?.getBiologicalParents();
82
+ const inter = parents1?.intersection(parentsN);
83
+ let prefix = "";
84
+ if (!inter || inter.length < 2) {
85
+ prefix = "Halb";
86
+ }
87
+ if (this.personN?.isMale()) {
88
+ return `${prefix}bruder`;
89
+ }
90
+ if (this.personN?.isFemale()) {
91
+ return `${prefix}schwester`;
92
+ }
93
+ return `${prefix}geschwister`;
94
+ }
95
+ spouse() {
96
+ if (this.personN?.isMale()) {
97
+ return "Ehemann";
98
+ }
99
+ if (this.personN?.isFemale()) {
100
+ return "Ehefrau";
101
+ }
102
+ return "Ehepartner";
103
+ }
104
+ ofSpouse(relation) {
105
+ if (!relation) {
106
+ return "";
107
+ }
108
+ const spouse = this.path?.[1].indi;
109
+ let spouseType = "Ehepartner";
110
+ if (spouse?.isMale()) {
111
+ spouseType = "Ehemann";
112
+ }
113
+ if (spouse?.isFemale()) {
114
+ spouseType = "Ehefrau";
115
+ }
116
+ return `${relation} des ${spouseType}s`;
117
+ }
118
+ spouseOf(relation) {
119
+ if (!relation) {
120
+ return "";
121
+ }
122
+ const spouse = this.path?.[this.path.length - 1].indi;
123
+ let spouseType = "Ehepartner";
124
+ if (spouse?.isMale()) {
125
+ spouseType = "Ehemann";
126
+ }
127
+ if (spouse?.isFemale()) {
128
+ spouseType = "Ehefrau";
129
+ }
130
+ return `${spouseType} von ${relation}`;
131
+ }
132
+ of(relation) {
133
+ const formattedName = nameFormatter(this.path?.[0]?.indi, {
134
+ nameOrder: "first-last",
135
+ });
136
+ let name = formattedName.inOrder.filter(Boolean).join(" ");
137
+ if (this.displayName === "none") {
138
+ name = "";
139
+ }
140
+ else if (this.displayName === "givenname") {
141
+ name = formattedName.givenname;
142
+ }
143
+ else if (this.displayName === "surname") {
144
+ name = `${formattedName.surname}`;
145
+ }
146
+ if (!name || !relation) {
147
+ return relation ?? "";
148
+ }
149
+ if (relation.includes(" des ") || relation.includes(" von ")) {
150
+ return relation.replace(/ (des|von) /, ` $1 ${name}s `);
151
+ }
152
+ return `${name}s ${relation}`;
153
+ }
154
+ inLaw(relation) {
155
+ let inLawRelation = relation;
156
+ Object.keys(InLawsDe).find((pattern) => {
157
+ const regex = new RegExp(`(?<space> )(?<word1>${pattern})$|^(?<word2>${pattern})$`);
158
+ if (relation?.match(regex)) {
159
+ inLawRelation = relation?.replace(regex, (m, ...rest) => {
160
+ const groups = rest[rest.length - 1];
161
+ const word = groups?.word1 || groups?.word2;
162
+ if (!word) {
163
+ return m;
164
+ }
165
+ const toReplace = InLawsDe[word.trim()] || InLawsDe[pattern];
166
+ return toReplace ? `${groups.space || ""}${toReplace}` : m;
167
+ });
168
+ return true;
169
+ }
170
+ return false;
171
+ });
172
+ return inLawRelation ?? "";
173
+ }
174
+ relationType(relation) {
175
+ if (!relation || !this.pathN?.relation) {
176
+ return relation ?? "";
177
+ }
178
+ return `${this.pathN.relation} ${relation}`;
179
+ }
180
+ }
@@ -0,0 +1,18 @@
1
+ import KinshipTranslatorBasic from "./kinship-translator.basic";
2
+ export default class KinshipTranslatorEn extends KinshipTranslatorBasic {
3
+ private directPrefix;
4
+ indirect(): string;
5
+ removal(): string;
6
+ auncle(): string;
7
+ nibling(): string;
8
+ parent(): string;
9
+ child(): string;
10
+ sibling(): string;
11
+ spouse(): "spouse" | "husband" | "wife";
12
+ ofSpouse(relation?: string | undefined): string;
13
+ spouseOf(relation?: string | undefined): string;
14
+ of(relation?: string | undefined): string;
15
+ inLaw(relation?: string | undefined): string;
16
+ relationType(relation?: string | undefined): string;
17
+ }
18
+ //# sourceMappingURL=kinship-translator.en.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kinship-translator.en.d.ts","sourceRoot":"","sources":["../../src/kinship-translator/kinship-translator.en.ts"],"names":[],"mappings":"AAGA,OAAO,sBAAsB,MAAM,4BAA4B,CAAC;AAGhE,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,sBAAsB;IACtE,OAAO,CAAC,YAAY;IAiBpB,QAAQ;IAaR,OAAO;IAcP,MAAM;IAcN,OAAO;IAcP,MAAM;IAcN,KAAK;IAcL,OAAO;IAuBP,MAAM;IAYN,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IAmBtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IAmBtC,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IA0BhC,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IAiCnC,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;CAO1C"}
@@ -0,0 +1,182 @@
1
+ import { nameFormatter } from "../utils/name-formatter";
2
+ import { ordinalize } from "../utils/ordinalize";
3
+ import KinshipTranslatorBasic from "./kinship-translator.basic";
4
+ import { InLawsEn } from "./patterns.en";
5
+ export default class KinshipTranslatorEn extends KinshipTranslatorBasic {
6
+ directPrefix() {
7
+ const level = Math.abs(this.pathN?.level ?? 0);
8
+ if (level <= 1) {
9
+ return "";
10
+ }
11
+ if (level === 2) {
12
+ return "grand";
13
+ }
14
+ if (level === 3) {
15
+ return "great-grand";
16
+ }
17
+ return `${ordinalize(level - 2)} great-grand`;
18
+ }
19
+ indirect() {
20
+ let degree = Math.abs(this.pathN?.degree ?? 0);
21
+ if (degree > 0) {
22
+ degree = degree - 1;
23
+ }
24
+ if (degree === 1) {
25
+ return `cousin`;
26
+ }
27
+ return `${ordinalize(degree)} cousin`;
28
+ }
29
+ removal() {
30
+ const level = this.pathN?.level ?? 0;
31
+ let degree = Math.abs(this.pathN?.degree ?? 0);
32
+ if (degree > 0) {
33
+ degree = degree - 1;
34
+ }
35
+ if (!degree) {
36
+ return level < 0 ? this.nibling() : this.auncle();
37
+ }
38
+ return `${ordinalize(degree)} cousin ${level}x removed`;
39
+ }
40
+ auncle() {
41
+ const prefix = this.directPrefix();
42
+ if (this.personN?.isMale()) {
43
+ return `${prefix}uncle`;
44
+ }
45
+ if (this.personN?.isFemale()) {
46
+ return `${prefix}aunt`;
47
+ }
48
+ return `${prefix}auncle`;
49
+ }
50
+ nibling() {
51
+ const prefix = this.directPrefix();
52
+ if (this.personN?.isMale()) {
53
+ return `${prefix}nephew`;
54
+ }
55
+ if (this.personN?.isFemale()) {
56
+ return `${prefix}niece`;
57
+ }
58
+ return `${prefix}nibling`;
59
+ }
60
+ parent() {
61
+ const prefix = this.directPrefix();
62
+ if (this.personN?.isMale()) {
63
+ return `${prefix}father`;
64
+ }
65
+ if (this.personN?.isFemale()) {
66
+ return `${prefix}mother`;
67
+ }
68
+ return `${prefix}parent`;
69
+ }
70
+ child() {
71
+ const prefix = this.directPrefix();
72
+ if (this.personN?.isMale()) {
73
+ return `${prefix}son`;
74
+ }
75
+ if (this.personN?.isFemale()) {
76
+ return `${prefix}daughter`;
77
+ }
78
+ return `${prefix}child`;
79
+ }
80
+ sibling() {
81
+ const parents1 = this.person1?.getBiologicalParents();
82
+ const parentsN = this.personN?.getBiologicalParents();
83
+ const inter = parents1?.intersection(parentsN);
84
+ // TODO if both has one parent in tree, this returns with an invalid/unsure half-blood state
85
+ let prefix = "";
86
+ if (!inter || inter.length < 2) {
87
+ prefix = "half-";
88
+ }
89
+ if (this.personN?.isMale()) {
90
+ return `${prefix}brother`;
91
+ }
92
+ if (this.personN?.isFemale()) {
93
+ return `${prefix}sister`;
94
+ }
95
+ return `${prefix}sibling`;
96
+ }
97
+ spouse() {
98
+ if (this.personN?.isMale()) {
99
+ return "husband";
100
+ }
101
+ if (this.personN?.isFemale()) {
102
+ return "wife";
103
+ }
104
+ return "spouse";
105
+ }
106
+ ofSpouse(relation) {
107
+ if (!relation) {
108
+ return "";
109
+ }
110
+ const spouse = this.path?.[1].indi;
111
+ let spouseType = "spouse";
112
+ if (spouse?.isMale()) {
113
+ spouseType = "husband";
114
+ }
115
+ if (spouse?.isFemale()) {
116
+ spouseType = "wife";
117
+ }
118
+ return `${relation} of ${spouseType}`;
119
+ }
120
+ spouseOf(relation) {
121
+ if (!relation) {
122
+ return "";
123
+ }
124
+ const spouse = this.path?.[this.path.length - 1].indi;
125
+ let spouseType = "spouse";
126
+ if (spouse?.isMale()) {
127
+ spouseType = "husband";
128
+ }
129
+ if (spouse?.isFemale()) {
130
+ spouseType = "wife";
131
+ }
132
+ return `${spouseType} of ${relation}`;
133
+ }
134
+ of(relation) {
135
+ const formattedName = nameFormatter(this.path?.[0]?.indi, {
136
+ nameOrder: "first-last",
137
+ });
138
+ let name = formattedName.inOrder.filter(Boolean).join(" ");
139
+ if (this.displayName === "none") {
140
+ name = "";
141
+ }
142
+ else if (this.displayName === "givenname") {
143
+ name = formattedName.givenname;
144
+ }
145
+ else if (this.displayName === "surname") {
146
+ name = `${formattedName.surname}`;
147
+ }
148
+ if (!name || !relation) {
149
+ return relation ?? "";
150
+ }
151
+ if (relation.includes(" of ")) {
152
+ return relation.replace(" of ", ` of ${name}'s `);
153
+ }
154
+ return `${name}'s ${relation}`;
155
+ }
156
+ inLaw(relation) {
157
+ let inLawRelation = relation;
158
+ Object.keys(InLawsEn).find((pattern) => {
159
+ const regex = new RegExp(`(?<space> )(?<word1>${pattern})$|^(?<word2>${pattern})$`);
160
+ if (relation?.match(regex)) {
161
+ inLawRelation = relation?.replace(regex, (m, ...rest) => {
162
+ const groups = rest[rest.length - 1];
163
+ const word = groups?.word1 || groups?.word2;
164
+ if (!word) {
165
+ return m;
166
+ }
167
+ const toReplace = InLawsEn[word.trim()] || InLawsEn[pattern];
168
+ return toReplace ? `${groups.space || ""}${toReplace}` : m;
169
+ });
170
+ return true;
171
+ }
172
+ return false;
173
+ });
174
+ return inLawRelation ?? "";
175
+ }
176
+ relationType(relation) {
177
+ if (!relation || !this.pathN?.relation) {
178
+ return relation ?? "";
179
+ }
180
+ return `${this.pathN.relation} ${relation}`;
181
+ }
182
+ }
@@ -0,0 +1,18 @@
1
+ import KinshipTranslatorBasic from "./kinship-translator.basic";
2
+ export default class KinshipTranslatorEs extends KinshipTranslatorBasic {
3
+ private directPrefix;
4
+ indirect(): string;
5
+ removal(): string;
6
+ auncle(): string;
7
+ nibling(): string;
8
+ parent(): string;
9
+ child(): string;
10
+ sibling(): string;
11
+ spouse(): "esposo" | "esposa" | "cónyuge";
12
+ ofSpouse(relation?: string | undefined): string;
13
+ spouseOf(relation?: string | undefined): string;
14
+ of(relation?: string | undefined): string;
15
+ inLaw(relation?: string | undefined): string;
16
+ relationType(relation?: string | undefined): string;
17
+ }
18
+ //# sourceMappingURL=kinship-translator.es.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kinship-translator.es.d.ts","sourceRoot":"","sources":["../../src/kinship-translator/kinship-translator.es.ts"],"names":[],"mappings":"AAGA,OAAO,sBAAsB,MAAM,4BAA4B,CAAC;AAGhE,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,sBAAsB;IACtE,OAAO,CAAC,YAAY;IAiBpB,QAAQ;IAaR,OAAO;IAcP,MAAM;IAcN,OAAO;IAcP,MAAM;IAcN,KAAK;IAcL,OAAO;IAsBP,MAAM;IAYN,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IAmBtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IAmBtC,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IA0BhC,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IAiCnC,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;CAO1C"}
@@ -0,0 +1,181 @@
1
+ import { nameFormatter } from "../utils/name-formatter";
2
+ import { ordinalize } from "../utils/ordinalize";
3
+ import KinshipTranslatorBasic from "./kinship-translator.basic";
4
+ import { InLawsEs } from "./patterns.es";
5
+ export default class KinshipTranslatorEs extends KinshipTranslatorBasic {
6
+ directPrefix() {
7
+ const level = Math.abs(this.pathN?.level ?? 0);
8
+ if (level <= 1) {
9
+ return "";
10
+ }
11
+ if (level === 2) {
12
+ return "bisabuel";
13
+ }
14
+ if (level === 3) {
15
+ return "tatarabuel";
16
+ }
17
+ return `tátara${level - 2}-abuel`;
18
+ }
19
+ indirect() {
20
+ let degree = Math.abs(this.pathN?.degree ?? 0);
21
+ if (degree > 0) {
22
+ degree = degree - 1;
23
+ }
24
+ if (degree === 1) {
25
+ return `primo`;
26
+ }
27
+ return `primo ${ordinalize(degree)}`;
28
+ }
29
+ removal() {
30
+ const level = this.pathN?.level ?? 0;
31
+ let degree = Math.abs(this.pathN?.degree ?? 0);
32
+ if (degree > 0) {
33
+ degree = degree - 1;
34
+ }
35
+ if (!degree) {
36
+ return level < 0 ? this.nibling() : this.auncle();
37
+ }
38
+ return `primo ${ordinalize(degree)} ${Math.abs(level)}× separado`;
39
+ }
40
+ auncle() {
41
+ const prefix = this.directPrefix();
42
+ if (this.personN?.isMale()) {
43
+ return `${prefix}tío`;
44
+ }
45
+ if (this.personN?.isFemale()) {
46
+ return `${prefix}tía`;
47
+ }
48
+ return `${prefix}tío/tía`;
49
+ }
50
+ nibling() {
51
+ const prefix = this.directPrefix();
52
+ if (this.personN?.isMale()) {
53
+ return `${prefix}sobrino`;
54
+ }
55
+ if (this.personN?.isFemale()) {
56
+ return `${prefix}sobrina`;
57
+ }
58
+ return `${prefix}sobrino/sobrina`;
59
+ }
60
+ parent() {
61
+ const prefix = this.directPrefix();
62
+ if (this.personN?.isMale()) {
63
+ return `${prefix}padre`;
64
+ }
65
+ if (this.personN?.isFemale()) {
66
+ return `${prefix}madre`;
67
+ }
68
+ return `${prefix}padre/madre`;
69
+ }
70
+ child() {
71
+ const prefix = this.directPrefix();
72
+ if (this.personN?.isMale()) {
73
+ return `${prefix}hijo`;
74
+ }
75
+ if (this.personN?.isFemale()) {
76
+ return `${prefix}hija`;
77
+ }
78
+ return `${prefix}hijo/hija`;
79
+ }
80
+ sibling() {
81
+ const parents1 = this.person1?.getBiologicalParents();
82
+ const parentsN = this.personN?.getBiologicalParents();
83
+ const inter = parents1?.intersection(parentsN);
84
+ let prefix = "";
85
+ if (!inter || inter.length < 2) {
86
+ prefix = "medio ";
87
+ }
88
+ if (this.personN?.isMale()) {
89
+ return `${prefix}hermano`;
90
+ }
91
+ if (this.personN?.isFemale()) {
92
+ return `${prefix}hermana`;
93
+ }
94
+ return `${prefix}hermano/hermana`;
95
+ }
96
+ spouse() {
97
+ if (this.personN?.isMale()) {
98
+ return "esposo";
99
+ }
100
+ if (this.personN?.isFemale()) {
101
+ return "esposa";
102
+ }
103
+ return "cónyuge";
104
+ }
105
+ ofSpouse(relation) {
106
+ if (!relation) {
107
+ return "";
108
+ }
109
+ const spouse = this.path?.[1].indi;
110
+ let spouseType = "cónyuge";
111
+ if (spouse?.isMale()) {
112
+ spouseType = "esposo";
113
+ }
114
+ if (spouse?.isFemale()) {
115
+ spouseType = "esposa";
116
+ }
117
+ return `${relation} del ${spouseType}`;
118
+ }
119
+ spouseOf(relation) {
120
+ if (!relation) {
121
+ return "";
122
+ }
123
+ const spouse = this.path?.[this.path.length - 1].indi;
124
+ let spouseType = "cónyuge";
125
+ if (spouse?.isMale()) {
126
+ spouseType = "esposo";
127
+ }
128
+ if (spouse?.isFemale()) {
129
+ spouseType = "esposa";
130
+ }
131
+ return `${spouseType} de ${relation}`;
132
+ }
133
+ of(relation) {
134
+ const formattedName = nameFormatter(this.path?.[0]?.indi, {
135
+ nameOrder: "first-last",
136
+ });
137
+ let name = formattedName.inOrder.filter(Boolean).join(" ");
138
+ if (this.displayName === "none") {
139
+ name = "";
140
+ }
141
+ else if (this.displayName === "givenname") {
142
+ name = formattedName.givenname;
143
+ }
144
+ else if (this.displayName === "surname") {
145
+ name = `${formattedName.surname}`;
146
+ }
147
+ if (!name || !relation) {
148
+ return relation ?? "";
149
+ }
150
+ if (relation.includes(" del ") || relation.includes(" de ")) {
151
+ return relation.replace(/ (del|de) /, ` $1 ${name} `);
152
+ }
153
+ return `${relation} de ${name}`;
154
+ }
155
+ inLaw(relation) {
156
+ let inLawRelation = relation;
157
+ Object.keys(InLawsEs).find((pattern) => {
158
+ const regex = new RegExp(`(?<space> )(?<word1>${pattern})$|^(?<word2>${pattern})$`);
159
+ if (relation?.match(regex)) {
160
+ inLawRelation = relation?.replace(regex, (m, ...rest) => {
161
+ const groups = rest[rest.length - 1];
162
+ const word = groups?.word1 || groups?.word2;
163
+ if (!word) {
164
+ return m;
165
+ }
166
+ const toReplace = InLawsEs[word.trim()] || InLawsEs[pattern];
167
+ return toReplace ? `${groups.space || ""}${toReplace}` : m;
168
+ });
169
+ return true;
170
+ }
171
+ return false;
172
+ });
173
+ return inLawRelation ?? "";
174
+ }
175
+ relationType(relation) {
176
+ if (!relation || !this.pathN?.relation) {
177
+ return relation ?? "";
178
+ }
179
+ return `${this.pathN.relation} ${relation}`;
180
+ }
181
+ }
@@ -0,0 +1,18 @@
1
+ import KinshipTranslatorBasic from "./kinship-translator.basic";
2
+ export default class KinshipTranslatorFr extends KinshipTranslatorBasic {
3
+ private directPrefix;
4
+ indirect(): string;
5
+ removal(): string;
6
+ auncle(): string;
7
+ nibling(): string;
8
+ parent(): string;
9
+ child(): string;
10
+ sibling(): string;
11
+ spouse(): "mari" | "épouse" | "conjoint";
12
+ ofSpouse(relation?: string | undefined): string;
13
+ spouseOf(relation?: string | undefined): string;
14
+ of(relation?: string | undefined): string;
15
+ inLaw(relation?: string | undefined): string;
16
+ relationType(relation?: string | undefined): string;
17
+ }
18
+ //# sourceMappingURL=kinship-translator.fr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"kinship-translator.fr.d.ts","sourceRoot":"","sources":["../../src/kinship-translator/kinship-translator.fr.ts"],"names":[],"mappings":"AAGA,OAAO,sBAAsB,MAAM,4BAA4B,CAAC;AAGhE,MAAM,CAAC,OAAO,OAAO,mBAAoB,SAAQ,sBAAsB;IACtE,OAAO,CAAC,YAAY;IAiBpB,QAAQ;IAaR,OAAO;IAcP,MAAM;IAcN,OAAO;IAcP,MAAM;IAcN,KAAK;IAcL,OAAO;IAsBP,MAAM;IAYN,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IAmBtC,QAAQ,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IAmBtC,EAAE,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IA0BhC,KAAK,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;IAiCnC,YAAY,CAAC,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS;CAO1C"}