@treeviz/gedcom-parser 2.0.9 → 2.0.10

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.
@@ -1363,7 +1363,8 @@ __export(translators_exports, {
1363
1363
  en: () => KinshipTranslatorEn,
1364
1364
  es: () => KinshipTranslatorEs,
1365
1365
  fr: () => KinshipTranslatorFr,
1366
- hu: () => KinshipTranslatorHU
1366
+ hu: () => KinshipTranslatorHU,
1367
+ ru: () => KinshipTranslatorRu
1367
1368
  });
1368
1369
 
1369
1370
  // src/constants/filters.ts
@@ -6200,6 +6201,249 @@ var KinshipTranslatorEs = class extends KinshipTranslatorBasic {
6200
6201
  }
6201
6202
  };
6202
6203
 
6204
+ // src/kinship-translator/patterns.ru.ts
6205
+ var InLawsRu = {
6206
+ "\u0441\u0443\u043F\u0440\u0443\u0433(?:\u0430)? (\u0440\u0435\u0431\u0451\u043D\u043A\u0430|\u0434\u043E\u0447\u0435\u0440\u0438|\u0441\u044B\u043D\u0430)": "\u0437\u044F\u0442\u044C/\u043D\u0435\u0432\u0435\u0441\u0442\u043A\u0430",
6207
+ "\u0436\u0435\u043D\u0430 (\u0440\u0435\u0431\u0451\u043D\u043A\u0430|\u0434\u043E\u0447\u0435\u0440\u0438|\u0441\u044B\u043D\u0430)": "\u043D\u0435\u0432\u0435\u0441\u0442\u043A\u0430",
6208
+ "\u043C\u0443\u0436 (\u0440\u0435\u0431\u0451\u043D\u043A\u0430|\u0434\u043E\u0447\u0435\u0440\u0438|\u0441\u044B\u043D\u0430)": "\u0437\u044F\u0442\u044C",
6209
+ "\u043C\u0430\u0442\u044C (\u0441\u0443\u043F\u0440\u0443\u0433\u0430|\u0436\u0435\u043D\u044B|\u043C\u0443\u0436\u0430)": "\u0442\u0451\u0449\u0430",
6210
+ "\u043E\u0442\u0435\u0446 (\u0441\u0443\u043F\u0440\u0443\u0433\u0430|\u0436\u0435\u043D\u044B|\u043C\u0443\u0436\u0430)": "\u0442\u0435\u0441\u0442\u044C",
6211
+ "\u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C (\u0441\u0443\u043F\u0440\u0443\u0433\u0430|\u0436\u0435\u043D\u044B|\u043C\u0443\u0436\u0430)": "\u0442\u0435\u0441\u0442\u044C/\u0442\u0451\u0449\u0430",
6212
+ "\u0436\u0435\u043D\u0430 (\u0441\u0432\u043E\u0434\u043D(?:\u044B\u0439|\u0430\u044F) )?(\u0431\u0440\u0430\u0442\u0430|\u0441\u0435\u0441\u0442\u0440\u044B|\u0441\u0438\u0431\u043B\u0438\u043D\u0433\u0430)": "\u043D\u0435\u0432\u0435\u0441\u0442\u043A\u0430",
6213
+ "\u043C\u0443\u0436 (\u0441\u0432\u043E\u0434\u043D(?:\u044B\u0439|\u0430\u044F) )?(\u0431\u0440\u0430\u0442\u0430|\u0441\u0435\u0441\u0442\u0440\u044B|\u0441\u0438\u0431\u043B\u0438\u043D\u0433\u0430)": "\u0437\u044F\u0442\u044C",
6214
+ "\u0441\u0443\u043F\u0440\u0443\u0433(?:\u0430)? (\u0441\u0432\u043E\u0434\u043D(?:\u044B\u0439|\u0430\u044F) )?(\u0431\u0440\u0430\u0442\u0430|\u0441\u0435\u0441\u0442\u0440\u044B|\u0441\u0438\u0431\u043B\u0438\u043D\u0433\u0430)": "\u0437\u044F\u0442\u044C/\u043D\u0435\u0432\u0435\u0441\u0442\u043A\u0430",
6215
+ "(\u0441\u0432\u043E\u0434\u043D(?:\u044B\u0439|\u0430\u044F) )?\u0441\u0435\u0441\u0442\u0440\u0430 (\u0441\u0443\u043F\u0440\u0443\u0433\u0430|\u0436\u0435\u043D\u044B|\u043C\u0443\u0436\u0430)": "\u0437\u043E\u043B\u043E\u0432\u043A\u0430",
6216
+ "(\u0441\u0432\u043E\u0434\u043D(?:\u044B\u0439|\u0430\u044F) )?\u0431\u0440\u0430\u0442 (\u0441\u0443\u043F\u0440\u0443\u0433\u0430|\u0436\u0435\u043D\u044B|\u043C\u0443\u0436\u0430)": "\u0448\u0443\u0440\u0438\u043D",
6217
+ "(\u0441\u0432\u043E\u0434\u043D(?:\u044B\u0439|\u0430\u044F) )?\u0441\u0438\u0431\u043B\u0438\u043D\u0433 (\u0441\u0443\u043F\u0440\u0443\u0433\u0430|\u0436\u0435\u043D\u044B|\u043C\u0443\u0436\u0430)": "\u0448\u0443\u0440\u0438\u043D/\u0437\u043E\u043B\u043E\u0432\u043A\u0430"
6218
+ };
6219
+
6220
+ // src/kinship-translator/kinship-translator.ru.ts
6221
+ var GENITIVE = {
6222
+ \u0441\u044B\u043D: "\u0441\u044B\u043D\u0430",
6223
+ \u0434\u043E\u0447\u044C: "\u0434\u043E\u0447\u0435\u0440\u0438",
6224
+ \u0440\u0435\u0431\u0451\u043D\u043E\u043A: "\u0440\u0435\u0431\u0451\u043D\u043A\u0430",
6225
+ \u0431\u0440\u0430\u0442: "\u0431\u0440\u0430\u0442\u0430",
6226
+ \u0441\u0435\u0441\u0442\u0440\u0430: "\u0441\u0435\u0441\u0442\u0440\u044B",
6227
+ \u0441\u0438\u0431\u043B\u0438\u043D\u0433: "\u0441\u0438\u0431\u043B\u0438\u043D\u0433\u0430",
6228
+ \u043E\u0442\u0435\u0446: "\u043E\u0442\u0446\u0430",
6229
+ \u043C\u0430\u0442\u044C: "\u043C\u0430\u0442\u0435\u0440\u0438",
6230
+ \u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C: "\u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044F",
6231
+ \u043C\u0443\u0436: "\u043C\u0443\u0436\u0430",
6232
+ \u0436\u0435\u043D\u0430: "\u0436\u0435\u043D\u044B",
6233
+ \u0441\u0443\u043F\u0440\u0443\u0433: "\u0441\u0443\u043F\u0440\u0443\u0433\u0430",
6234
+ \u0441\u0443\u043F\u0440\u0443\u0433\u0430: "\u0441\u0443\u043F\u0440\u0443\u0433\u0438"
6235
+ };
6236
+ var toGenitive = (word) => GENITIVE[word] ?? word;
6237
+ var cousinWord = (degree, sex) => {
6238
+ const stem = degree <= 1 ? "\u0434\u0432\u043E\u044E\u0440\u043E\u0434\u043D" : degree === 2 ? "\u0442\u0440\u043E\u044E\u0440\u043E\u0434\u043D" : degree === 3 ? "\u0447\u0435\u0442\u0432\u0435\u0440\u043E\u044E\u0440\u043E\u0434\u043D" : `${degree + 1}-\u044E\u0440\u043E\u0434\u043D`;
6239
+ if (sex === "m") {
6240
+ return `${stem}\u044B\u0439 \u0431\u0440\u0430\u0442`;
6241
+ }
6242
+ if (sex === "f") {
6243
+ return `${stem}\u0430\u044F \u0441\u0435\u0441\u0442\u0440\u0430`;
6244
+ }
6245
+ return `${stem}\u044B\u0439 \u0431\u0440\u0430\u0442/\u0441\u0435\u0441\u0442\u0440\u0430`;
6246
+ };
6247
+ var praRepeat = (count) => count > 0 ? "\u043F\u0440\u0430".repeat(count) : "";
6248
+ var sexOf = (person) => {
6249
+ if (person?.isMale?.()) {
6250
+ return "m";
6251
+ }
6252
+ if (person?.isFemale?.()) {
6253
+ return "f";
6254
+ }
6255
+ return "n";
6256
+ };
6257
+ var KinshipTranslatorRu = class extends KinshipTranslatorBasic {
6258
+ indirect() {
6259
+ let degree = Math.abs(this.pathN?.degree ?? 0);
6260
+ if (degree > 0) {
6261
+ degree = degree - 1;
6262
+ }
6263
+ return cousinWord(degree, sexOf(this.personN));
6264
+ }
6265
+ removal() {
6266
+ const level = this.pathN?.level ?? 0;
6267
+ let degree = Math.abs(this.pathN?.degree ?? 0);
6268
+ if (degree > 0) {
6269
+ degree = degree - 1;
6270
+ }
6271
+ if (!degree) {
6272
+ return level < 0 ? this.nibling() : this.auncle();
6273
+ }
6274
+ const removed = Math.abs(level);
6275
+ return `${cousinWord(degree, sexOf(this.personN))} (${removed}\xD7 \u0447\u0435\u0440\u0435\u0437 \u043F\u043E\u043A\u043E\u043B\u0435\u043D\u0438\u0435)`;
6276
+ }
6277
+ auncle() {
6278
+ const level = Math.abs(this.pathN?.level ?? 0);
6279
+ const pra = praRepeat(Math.max(0, level - 2));
6280
+ const sex = sexOf(this.personN);
6281
+ if (sex === "m") {
6282
+ return `${pra}\u0434\u044F\u0434\u044F`;
6283
+ }
6284
+ if (sex === "f") {
6285
+ return `${pra}\u0442\u0451\u0442\u044F`;
6286
+ }
6287
+ return `${pra}\u0434\u044F\u0434\u044F/\u0442\u0451\u0442\u044F`;
6288
+ }
6289
+ nibling() {
6290
+ const level = Math.abs(this.pathN?.level ?? 0);
6291
+ const pra = praRepeat(Math.max(0, level - 2));
6292
+ const sex = sexOf(this.personN);
6293
+ if (sex === "m") {
6294
+ return `${pra}\u043F\u043B\u0435\u043C\u044F\u043D\u043D\u0438\u043A`;
6295
+ }
6296
+ if (sex === "f") {
6297
+ return `${pra}\u043F\u043B\u0435\u043C\u044F\u043D\u043D\u0438\u0446\u0430`;
6298
+ }
6299
+ return `${pra}\u043F\u043B\u0435\u043C\u044F\u043D\u043D\u0438\u043A/\u043F\u043B\u0435\u043C\u044F\u043D\u043D\u0438\u0446\u0430`;
6300
+ }
6301
+ parent() {
6302
+ const level = Math.abs(this.pathN?.level ?? 0);
6303
+ const sex = sexOf(this.personN);
6304
+ if (level <= 1) {
6305
+ if (sex === "m") {
6306
+ return "\u043E\u0442\u0435\u0446";
6307
+ }
6308
+ if (sex === "f") {
6309
+ return "\u043C\u0430\u0442\u044C";
6310
+ }
6311
+ return "\u0440\u043E\u0434\u0438\u0442\u0435\u043B\u044C";
6312
+ }
6313
+ if (level === 2) {
6314
+ if (sex === "m") {
6315
+ return "\u0434\u0435\u0434";
6316
+ }
6317
+ if (sex === "f") {
6318
+ return "\u0431\u0430\u0431\u0443\u0448\u043A\u0430";
6319
+ }
6320
+ return "\u0434\u0435\u0434/\u0431\u0430\u0431\u0443\u0448\u043A\u0430";
6321
+ }
6322
+ const pra = praRepeat(level - 2);
6323
+ if (sex === "m") {
6324
+ return `${pra}\u0434\u0435\u0434`;
6325
+ }
6326
+ if (sex === "f") {
6327
+ return `${pra}\u0431\u0430\u0431\u0443\u0448\u043A\u0430`;
6328
+ }
6329
+ return `${pra}\u0434\u0435\u0434/\u0431\u0430\u0431\u0443\u0448\u043A\u0430`;
6330
+ }
6331
+ child() {
6332
+ const level = Math.abs(this.pathN?.level ?? 0);
6333
+ const sex = sexOf(this.personN);
6334
+ if (level <= 1) {
6335
+ if (sex === "m") {
6336
+ return "\u0441\u044B\u043D";
6337
+ }
6338
+ if (sex === "f") {
6339
+ return "\u0434\u043E\u0447\u044C";
6340
+ }
6341
+ return "\u0440\u0435\u0431\u0451\u043D\u043E\u043A";
6342
+ }
6343
+ if (level === 2) {
6344
+ if (sex === "m") {
6345
+ return "\u0432\u043D\u0443\u043A";
6346
+ }
6347
+ if (sex === "f") {
6348
+ return "\u0432\u043D\u0443\u0447\u043A\u0430";
6349
+ }
6350
+ return "\u0432\u043D\u0443\u043A/\u0432\u043D\u0443\u0447\u043A\u0430";
6351
+ }
6352
+ const pra = praRepeat(level - 2);
6353
+ if (sex === "m") {
6354
+ return `${pra}\u0432\u043D\u0443\u043A`;
6355
+ }
6356
+ if (sex === "f") {
6357
+ return `${pra}\u0432\u043D\u0443\u0447\u043A\u0430`;
6358
+ }
6359
+ return `${pra}\u0432\u043D\u0443\u043A/\u0432\u043D\u0443\u0447\u043A\u0430`;
6360
+ }
6361
+ sibling() {
6362
+ const sex = sexOf(this.personN);
6363
+ if (sex === "m") {
6364
+ return "\u0431\u0440\u0430\u0442";
6365
+ }
6366
+ if (sex === "f") {
6367
+ return "\u0441\u0435\u0441\u0442\u0440\u0430";
6368
+ }
6369
+ return "\u0441\u0438\u0431\u043B\u0438\u043D\u0433";
6370
+ }
6371
+ halfBlood(relation) {
6372
+ if (!relation || !this.isHalfBlood) {
6373
+ return relation ?? "";
6374
+ }
6375
+ if (/сестра|дочь|мать|тётя|бабушка|жена|племянница|внучка/.test(
6376
+ relation
6377
+ )) {
6378
+ return `\u0441\u0432\u043E\u0434\u043D\u0430\u044F ${relation}`;
6379
+ }
6380
+ return `\u0441\u0432\u043E\u0434\u043D\u044B\u0439 ${relation}`;
6381
+ }
6382
+ spouse() {
6383
+ const sex = sexOf(this.personN);
6384
+ if (sex === "m") {
6385
+ return "\u043C\u0443\u0436";
6386
+ }
6387
+ if (sex === "f") {
6388
+ return "\u0436\u0435\u043D\u0430";
6389
+ }
6390
+ return "\u0441\u0443\u043F\u0440\u0443\u0433";
6391
+ }
6392
+ ofSpouse(relation) {
6393
+ if (!relation) {
6394
+ return "";
6395
+ }
6396
+ const spouse = this.path?.[1].indi;
6397
+ const sex = sexOf(spouse);
6398
+ const spouseType = sex === "m" ? "\u043C\u0443\u0436" : sex === "f" ? "\u0436\u0435\u043D\u0430" : "\u0441\u0443\u043F\u0440\u0443\u0433";
6399
+ return `${relation} ${toGenitive(spouseType)}`;
6400
+ }
6401
+ spouseOf(relation) {
6402
+ if (!relation) {
6403
+ return "";
6404
+ }
6405
+ const spouse = this.path?.[this.path.length - 1].indi;
6406
+ const sex = sexOf(spouse);
6407
+ const spouseType = sex === "m" ? "\u043C\u0443\u0436" : sex === "f" ? "\u0436\u0435\u043D\u0430" : "\u0441\u0443\u043F\u0440\u0443\u0433";
6408
+ return `${spouseType} ${toGenitive(relation)}`;
6409
+ }
6410
+ of(relation) {
6411
+ const formattedName = nameFormatter(this.path?.[0]?.indi, {
6412
+ nameOrder: "first-last"
6413
+ });
6414
+ let name = formattedName.inOrder.filter(Boolean).join(" ");
6415
+ if (this.displayName === "none") {
6416
+ name = "";
6417
+ } else if (this.displayName === "givenname") {
6418
+ name = formattedName.givenname;
6419
+ } else if (this.displayName === "surname") {
6420
+ name = `${formattedName.surname}`;
6421
+ }
6422
+ if (!name || !relation) {
6423
+ return relation ?? "";
6424
+ }
6425
+ return `${name}: ${relation}`;
6426
+ }
6427
+ inLaw(relation) {
6428
+ let inLawRelation = relation;
6429
+ Object.keys(InLawsRu).find((pattern) => {
6430
+ const regex = new RegExp(`^${pattern}$`);
6431
+ if (relation?.match(regex)) {
6432
+ inLawRelation = InLawsRu[pattern];
6433
+ return true;
6434
+ }
6435
+ return false;
6436
+ });
6437
+ return inLawRelation ?? "";
6438
+ }
6439
+ relationType(relation) {
6440
+ if (!relation || !this.pathN?.relation) {
6441
+ return relation ?? "";
6442
+ }
6443
+ return `${this.pathN.relation} ${relation}`;
6444
+ }
6445
+ };
6446
+
6203
6447
  // src/kinship-translator/kinship-translator.ts
6204
6448
  var KinshipTranslator = class {
6205
6449
  constructor(person1, person2, lang = "en", entirePath, displayName = "givenname") {
@@ -6754,7 +6998,7 @@ var isCommonDate = (value) => {
6754
6998
  // package.json
6755
6999
  var package_default = {
6756
7000
  name: "@treeviz/gedcom-parser",
6757
- version: "2.0.9"};
7001
+ version: "2.0.10"};
6758
7002
 
6759
7003
  // src/utils/get-product-details.ts
6760
7004
  var isDevelopment = () => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@treeviz/gedcom-parser",
3
- "version": "2.0.9",
3
+ "version": "2.0.10",
4
4
  "description": "Lightweight, pluggable GEDCOM parser for JavaScript/TypeScript with optional caching and place matching. Zero browser dependencies.",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",