@treeviz/gedcom-parser 1.0.13 → 1.0.15
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/dist/classes/index.d.ts +2 -28
- package/dist/classes/index.js +6713 -21
- package/dist/classes/index.js.map +1 -0
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.js +7826 -24
- package/dist/cli/index.js.map +1 -0
- package/dist/constants/index.d.ts +49 -4
- package/dist/constants/index.js +5797 -4
- package/dist/constants/index.js.map +1 -0
- package/dist/factories/index.d.ts +202 -13
- package/dist/factories/index.js +5782 -8
- package/dist/factories/index.js.map +1 -0
- package/dist/index-BvW-KWJP.d.ts +1654 -0
- package/dist/index.d.ts +9 -28
- package/dist/index.js +7380 -35
- package/dist/index.js.map +1 -0
- package/dist/interfaces/index.d.ts +2 -12
- package/dist/interfaces/index.js +3 -1
- package/dist/interfaces/index.js.map +1 -0
- package/dist/kinship-translator/index.d.ts +146 -11
- package/dist/kinship-translator/index.js +5727 -9
- package/dist/kinship-translator/index.js.map +1 -0
- package/dist/place-parser-RlXCXZ8F.d.ts +37 -0
- package/dist/structures/index.d.ts +25 -27
- package/dist/structures/index.js +3 -1
- package/dist/structures/index.js.map +1 -0
- package/dist/types/index.d.ts +69 -8
- package/dist/types/index.js +31 -6
- package/dist/types/index.js.map +1 -0
- package/dist/utils/index.d.ts +91 -18
- package/dist/utils/index.js +6953 -17
- package/dist/utils/index.js.map +1 -0
- package/package.json +4 -3
- package/dist/classes/common.d.ts +0 -91
- package/dist/classes/common.d.ts.map +0 -1
- package/dist/classes/common.js +0 -488
- package/dist/classes/date.d.ts +0 -27
- package/dist/classes/date.d.ts.map +0 -1
- package/dist/classes/date.js +0 -178
- package/dist/classes/fam.d.ts +0 -19
- package/dist/classes/fam.d.ts.map +0 -1
- package/dist/classes/fam.js +0 -38
- package/dist/classes/fams.d.ts +0 -16
- package/dist/classes/fams.d.ts.map +0 -1
- package/dist/classes/fams.js +0 -41
- package/dist/classes/gedcom.d.ts +0 -139
- package/dist/classes/gedcom.d.ts.map +0 -1
- package/dist/classes/gedcom.js +0 -910
- package/dist/classes/index.d.ts.map +0 -1
- package/dist/classes/indi.d.ts +0 -323
- package/dist/classes/indi.d.ts.map +0 -1
- package/dist/classes/indi.js +0 -2131
- package/dist/classes/indis.d.ts +0 -55
- package/dist/classes/indis.d.ts.map +0 -1
- package/dist/classes/indis.js +0 -457
- package/dist/classes/list.d.ts +0 -55
- package/dist/classes/list.d.ts.map +0 -1
- package/dist/classes/list.js +0 -440
- package/dist/classes/name.d.ts +0 -20
- package/dist/classes/name.d.ts.map +0 -1
- package/dist/classes/name.js +0 -48
- package/dist/classes/note.d.ts +0 -12
- package/dist/classes/note.d.ts.map +0 -1
- package/dist/classes/note.js +0 -46
- package/dist/classes/obje.d.ts +0 -12
- package/dist/classes/obje.d.ts.map +0 -1
- package/dist/classes/obje.js +0 -81
- package/dist/classes/objes.d.ts +0 -8
- package/dist/classes/objes.d.ts.map +0 -1
- package/dist/classes/objes.js +0 -13
- package/dist/classes/repo.d.ts +0 -11
- package/dist/classes/repo.d.ts.map +0 -1
- package/dist/classes/repo.js +0 -6
- package/dist/classes/repos.d.ts +0 -8
- package/dist/classes/repos.d.ts.map +0 -1
- package/dist/classes/repos.js +0 -13
- package/dist/classes/sour.d.ts +0 -11
- package/dist/classes/sour.d.ts.map +0 -1
- package/dist/classes/sour.js +0 -6
- package/dist/classes/sours.d.ts +0 -8
- package/dist/classes/sours.d.ts.map +0 -1
- package/dist/classes/sours.js +0 -13
- package/dist/classes/subm.d.ts +0 -10
- package/dist/classes/subm.d.ts.map +0 -1
- package/dist/classes/subm.js +0 -6
- package/dist/classes/subms.d.ts +0 -8
- package/dist/classes/subms.d.ts.map +0 -1
- package/dist/classes/subms.js +0 -13
- package/dist/cli/commands/convert.d.ts +0 -3
- package/dist/cli/commands/convert.d.ts.map +0 -1
- package/dist/cli/commands/convert.js +0 -83
- package/dist/cli/commands/extract.d.ts +0 -3
- package/dist/cli/commands/extract.d.ts.map +0 -1
- package/dist/cli/commands/extract.js +0 -85
- package/dist/cli/commands/find.d.ts +0 -3
- package/dist/cli/commands/find.d.ts.map +0 -1
- package/dist/cli/commands/find.js +0 -97
- package/dist/cli/commands/info.d.ts +0 -3
- package/dist/cli/commands/info.d.ts.map +0 -1
- package/dist/cli/commands/info.js +0 -80
- package/dist/cli/commands/merge.d.ts +0 -3
- package/dist/cli/commands/merge.d.ts.map +0 -1
- package/dist/cli/commands/merge.js +0 -61
- package/dist/cli/commands/relatives.d.ts +0 -3
- package/dist/cli/commands/relatives.d.ts.map +0 -1
- package/dist/cli/commands/relatives.js +0 -107
- package/dist/cli/commands/show.d.ts +0 -3
- package/dist/cli/commands/show.d.ts.map +0 -1
- package/dist/cli/commands/show.js +0 -176
- package/dist/cli/commands/stats.d.ts +0 -3
- package/dist/cli/commands/stats.d.ts.map +0 -1
- package/dist/cli/commands/stats.js +0 -59
- package/dist/cli/commands/validate.d.ts +0 -3
- package/dist/cli/commands/validate.d.ts.map +0 -1
- package/dist/cli/commands/validate.js +0 -148
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/utils/formatters.d.ts +0 -69
- package/dist/cli/utils/formatters.d.ts.map +0 -1
- package/dist/cli/utils/formatters.js +0 -125
- package/dist/cli/utils/helpers.d.ts +0 -21
- package/dist/cli/utils/helpers.d.ts.map +0 -1
- package/dist/cli/utils/helpers.js +0 -58
- package/dist/constants/constants.d.ts +0 -14
- package/dist/constants/constants.d.ts.map +0 -1
- package/dist/constants/constants.js +0 -13
- package/dist/constants/filters.d.ts +0 -18
- package/dist/constants/filters.d.ts.map +0 -1
- package/dist/constants/filters.js +0 -44
- package/dist/constants/index.d.ts.map +0 -1
- package/dist/constants/orders.d.ts +0 -17
- package/dist/constants/orders.d.ts.map +0 -1
- package/dist/constants/orders.js +0 -240
- package/dist/factories/cache-factory.d.ts +0 -30
- package/dist/factories/cache-factory.d.ts.map +0 -1
- package/dist/factories/cache-factory.js +0 -43
- package/dist/factories/date-locale-factory.d.ts +0 -30
- package/dist/factories/date-locale-factory.d.ts.map +0 -1
- package/dist/factories/date-locale-factory.js +0 -34
- package/dist/factories/i18n-factory.d.ts +0 -40
- package/dist/factories/i18n-factory.d.ts.map +0 -1
- package/dist/factories/i18n-factory.js +0 -44
- package/dist/factories/index.d.ts.map +0 -1
- package/dist/factories/kinship-factory.d.ts +0 -38
- package/dist/factories/kinship-factory.d.ts.map +0 -1
- package/dist/factories/kinship-factory.js +0 -35
- package/dist/factories/place-parser-provider.d.ts +0 -32
- package/dist/factories/place-parser-provider.d.ts.map +0 -1
- package/dist/factories/place-parser-provider.js +0 -35
- package/dist/factories/place-translator-provider.d.ts +0 -32
- package/dist/factories/place-translator-provider.d.ts.map +0 -1
- package/dist/factories/place-translator-provider.js +0 -35
- package/dist/index.d.ts.map +0 -1
- package/dist/interfaces/common.d.ts +0 -43
- package/dist/interfaces/common.d.ts.map +0 -1
- package/dist/interfaces/common.js +0 -1
- package/dist/interfaces/fam.d.ts +0 -11
- package/dist/interfaces/fam.d.ts.map +0 -1
- package/dist/interfaces/fam.js +0 -1
- package/dist/interfaces/fams.d.ts +0 -9
- package/dist/interfaces/fams.d.ts.map +0 -1
- package/dist/interfaces/fams.js +0 -1
- package/dist/interfaces/gedcom.d.ts +0 -30
- package/dist/interfaces/gedcom.d.ts.map +0 -1
- package/dist/interfaces/gedcom.js +0 -1
- package/dist/interfaces/index.d.ts.map +0 -1
- package/dist/interfaces/indi.d.ts +0 -113
- package/dist/interfaces/indi.d.ts.map +0 -1
- package/dist/interfaces/indi.js +0 -1
- package/dist/interfaces/indis.d.ts +0 -31
- package/dist/interfaces/indis.d.ts.map +0 -1
- package/dist/interfaces/indis.js +0 -1
- package/dist/interfaces/list.d.ts +0 -52
- package/dist/interfaces/list.d.ts.map +0 -1
- package/dist/interfaces/list.js +0 -1
- package/dist/interfaces/obje.d.ts +0 -7
- package/dist/interfaces/obje.d.ts.map +0 -1
- package/dist/interfaces/obje.js +0 -1
- package/dist/interfaces/repo.d.ts +0 -7
- package/dist/interfaces/repo.d.ts.map +0 -1
- package/dist/interfaces/repo.js +0 -1
- package/dist/interfaces/sour.d.ts +0 -7
- package/dist/interfaces/sour.d.ts.map +0 -1
- package/dist/interfaces/sour.js +0 -1
- package/dist/interfaces/subm.d.ts +0 -6
- package/dist/interfaces/subm.d.ts.map +0 -1
- package/dist/interfaces/subm.js +0 -1
- package/dist/kinship-translator/index.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.basic.d.ts +0 -30
- package/dist/kinship-translator/kinship-translator.basic.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.basic.js +0 -74
- package/dist/kinship-translator/kinship-translator.d.ts +0 -26
- package/dist/kinship-translator/kinship-translator.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.de.d.ts +0 -18
- package/dist/kinship-translator/kinship-translator.de.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.de.js +0 -180
- package/dist/kinship-translator/kinship-translator.en.d.ts +0 -18
- package/dist/kinship-translator/kinship-translator.en.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.en.js +0 -182
- package/dist/kinship-translator/kinship-translator.es.d.ts +0 -18
- package/dist/kinship-translator/kinship-translator.es.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.es.js +0 -181
- package/dist/kinship-translator/kinship-translator.fr.d.ts +0 -18
- package/dist/kinship-translator/kinship-translator.fr.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.fr.js +0 -181
- package/dist/kinship-translator/kinship-translator.hu.d.ts +0 -19
- package/dist/kinship-translator/kinship-translator.hu.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.hu.js +0 -226
- package/dist/kinship-translator/kinship-translator.interface.d.ts +0 -19
- package/dist/kinship-translator/kinship-translator.interface.d.ts.map +0 -1
- package/dist/kinship-translator/kinship-translator.interface.js +0 -1
- package/dist/kinship-translator/kinship-translator.js +0 -103
- package/dist/kinship-translator/patterns.de.d.ts +0 -2
- package/dist/kinship-translator/patterns.de.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.de.js +0 -14
- package/dist/kinship-translator/patterns.en.d.ts +0 -2
- package/dist/kinship-translator/patterns.en.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.en.js +0 -14
- package/dist/kinship-translator/patterns.es.d.ts +0 -2
- package/dist/kinship-translator/patterns.es.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.es.js +0 -14
- package/dist/kinship-translator/patterns.fr.d.ts +0 -2
- package/dist/kinship-translator/patterns.fr.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.fr.js +0 -14
- package/dist/kinship-translator/patterns.hu.d.ts +0 -6
- package/dist/kinship-translator/patterns.hu.d.ts.map +0 -1
- package/dist/kinship-translator/patterns.hu.js +0 -97
- package/dist/kinship-translator/translators.d.ts +0 -6
- package/dist/kinship-translator/translators.d.ts.map +0 -1
- package/dist/kinship-translator/translators.js +0 -5
- package/dist/kinship-translator/types.d.ts +0 -9
- package/dist/kinship-translator/types.d.ts.map +0 -1
- package/dist/kinship-translator/types.js +0 -1
- package/dist/structures/address.d.ts +0 -14
- package/dist/structures/address.d.ts.map +0 -1
- package/dist/structures/address.js +0 -1
- package/dist/structures/association.d.ts +0 -13
- package/dist/structures/association.d.ts.map +0 -1
- package/dist/structures/association.js +0 -1
- package/dist/structures/change-date.d.ts +0 -8
- package/dist/structures/change-date.d.ts.map +0 -1
- package/dist/structures/change-date.js +0 -1
- package/dist/structures/creation-date.d.ts +0 -7
- package/dist/structures/creation-date.d.ts.map +0 -1
- package/dist/structures/creation-date.js +0 -1
- package/dist/structures/date.d.ts +0 -9
- package/dist/structures/date.d.ts.map +0 -1
- package/dist/structures/date.js +0 -1
- package/dist/structures/event-detail-structure.d.ts +0 -25
- package/dist/structures/event-detail-structure.d.ts.map +0 -1
- package/dist/structures/event-detail-structure.js +0 -1
- package/dist/structures/family.d.ts +0 -34
- package/dist/structures/family.d.ts.map +0 -1
- package/dist/structures/family.js +0 -1
- package/dist/structures/gedcom.d.ts +0 -59
- package/dist/structures/gedcom.d.ts.map +0 -1
- package/dist/structures/gedcom.js +0 -1
- package/dist/structures/index.d.ts.map +0 -1
- package/dist/structures/individual-event-detail-structure.d.ts +0 -9
- package/dist/structures/individual-event-detail-structure.d.ts.map +0 -1
- package/dist/structures/individual-event-detail-structure.js +0 -1
- package/dist/structures/individual-event-structure.d.ts +0 -83
- package/dist/structures/individual-event-structure.d.ts.map +0 -1
- package/dist/structures/individual-event-structure.js +0 -1
- package/dist/structures/individual.d.ts +0 -40
- package/dist/structures/individual.d.ts.map +0 -1
- package/dist/structures/individual.js +0 -1
- package/dist/structures/lds-ordinance-detail.d.ts +0 -17
- package/dist/structures/lds-ordinance-detail.d.ts.map +0 -1
- package/dist/structures/lds-ordinance-detail.js +0 -1
- package/dist/structures/lds-spouse-sealing.d.ts +0 -7
- package/dist/structures/lds-spouse-sealing.d.ts.map +0 -1
- package/dist/structures/lds-spouse-sealing.js +0 -1
- package/dist/structures/marriage-date.d.ts +0 -11
- package/dist/structures/marriage-date.d.ts.map +0 -1
- package/dist/structures/marriage-date.js +0 -1
- package/dist/structures/multimedia-link.d.ts +0 -16
- package/dist/structures/multimedia-link.d.ts.map +0 -1
- package/dist/structures/multimedia-link.js +0 -1
- package/dist/structures/non-event.d.ts +0 -12
- package/dist/structures/non-event.d.ts.map +0 -1
- package/dist/structures/non-event.js +0 -1
- package/dist/structures/note.d.ts +0 -16
- package/dist/structures/note.d.ts.map +0 -1
- package/dist/structures/note.js +0 -1
- package/dist/structures/personal-name-pieces.d.ts +0 -11
- package/dist/structures/personal-name-pieces.d.ts.map +0 -1
- package/dist/structures/personal-name-pieces.js +0 -1
- package/dist/structures/personal-name.d.ts +0 -16
- package/dist/structures/personal-name.d.ts.map +0 -1
- package/dist/structures/personal-name.js +0 -1
- package/dist/structures/place.d.ts +0 -20
- package/dist/structures/place.d.ts.map +0 -1
- package/dist/structures/place.js +0 -1
- package/dist/structures/repository.d.ts +0 -6
- package/dist/structures/repository.d.ts.map +0 -1
- package/dist/structures/repository.js +0 -1
- package/dist/structures/source-citation.d.ts +0 -27
- package/dist/structures/source-citation.d.ts.map +0 -1
- package/dist/structures/source-citation.js +0 -1
- package/dist/structures/source-repository-citation.d.ts +0 -13
- package/dist/structures/source-repository-citation.d.ts.map +0 -1
- package/dist/structures/source-repository-citation.js +0 -1
- package/dist/structures/source.d.ts +0 -28
- package/dist/structures/source.d.ts.map +0 -1
- package/dist/structures/source.js +0 -1
- package/dist/types/ancestry-media.d.ts +0 -65
- package/dist/types/ancestry-media.d.ts.map +0 -1
- package/dist/types/ancestry-media.js +0 -1
- package/dist/types/index.d.ts.map +0 -1
- package/dist/types/settings.d.ts +0 -12
- package/dist/types/settings.d.ts.map +0 -1
- package/dist/types/settings.js +0 -1
- package/dist/types/types.d.ts +0 -225
- package/dist/types/types.d.ts.map +0 -1
- package/dist/types/types.js +0 -26
- package/dist/utils/cache.d.ts +0 -22
- package/dist/utils/cache.d.ts.map +0 -1
- package/dist/utils/cache.js +0 -57
- package/dist/utils/common-creator.d.ts +0 -13
- package/dist/utils/common-creator.d.ts.map +0 -1
- package/dist/utils/common-creator.js +0 -72
- package/dist/utils/date-formatter.d.ts +0 -35
- package/dist/utils/date-formatter.d.ts.map +0 -1
- package/dist/utils/date-formatter.js +0 -207
- package/dist/utils/get-all-prop.d.ts +0 -4
- package/dist/utils/get-all-prop.d.ts.map +0 -1
- package/dist/utils/get-all-prop.js +0 -5
- package/dist/utils/get-family-with.d.ts +0 -5
- package/dist/utils/get-family-with.d.ts.map +0 -1
- package/dist/utils/get-family-with.js +0 -11
- package/dist/utils/get-places.d.ts +0 -21
- package/dist/utils/get-places.d.ts.map +0 -1
- package/dist/utils/get-places.js +0 -77
- package/dist/utils/get-product-details.d.ts +0 -4
- package/dist/utils/get-product-details.d.ts.map +0 -1
- package/dist/utils/get-product-details.js +0 -6
- package/dist/utils/get-raw-size.d.ts +0 -2
- package/dist/utils/get-raw-size.d.ts.map +0 -1
- package/dist/utils/get-raw-size.js +0 -3
- package/dist/utils/index.d.ts.map +0 -1
- package/dist/utils/logger.d.ts +0 -3
- package/dist/utils/logger.d.ts.map +0 -1
- package/dist/utils/logger.js +0 -11
- package/dist/utils/name-formatter.d.ts +0 -10
- package/dist/utils/name-formatter.d.ts.map +0 -1
- package/dist/utils/name-formatter.js +0 -45
- package/dist/utils/nested-group.d.ts +0 -4
- package/dist/utils/nested-group.d.ts.map +0 -1
- package/dist/utils/nested-group.js +0 -34
- package/dist/utils/ordinalize.d.ts +0 -3
- package/dist/utils/ordinalize.d.ts.map +0 -1
- package/dist/utils/ordinalize.js +0 -104
- package/dist/utils/parser.d.ts +0 -17
- package/dist/utils/parser.d.ts.map +0 -1
- package/dist/utils/parser.js +0 -321
- package/dist/utils/place-parser.d.ts +0 -16
- package/dist/utils/place-parser.d.ts.map +0 -1
- package/dist/utils/place-parser.js +0 -46
- package/dist/utils/place-translator.d.ts +0 -6
- package/dist/utils/place-translator.d.ts.map +0 -1
- package/dist/utils/place-translator.js +0 -8
- package/dist/utils/place-types.d.ts +0 -27
- package/dist/utils/place-types.d.ts.map +0 -1
- package/dist/utils/place-types.js +0 -14
- package/dist/utils/range.d.ts +0 -19
- package/dist/utils/range.d.ts.map +0 -1
- package/dist/utils/range.js +0 -265
package/dist/classes/list.js
DELETED
|
@@ -1,440 +0,0 @@
|
|
|
1
|
-
import differenceBy from "lodash-es/differenceBy.js";
|
|
2
|
-
import get from "lodash-es/get.js";
|
|
3
|
-
import intersectionBy from "lodash-es/intersectionBy.js";
|
|
4
|
-
import set from "lodash-es/set.js";
|
|
5
|
-
import unset from "lodash-es/unset.js";
|
|
6
|
-
import { getValidTag } from "./common.js";
|
|
7
|
-
export class List {
|
|
8
|
-
// length = 0;
|
|
9
|
-
constructor(items) {
|
|
10
|
-
this.items = {};
|
|
11
|
-
this.isListable = true;
|
|
12
|
-
this.marker = undefined;
|
|
13
|
-
if (items) {
|
|
14
|
-
this.concat(items);
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
get length() {
|
|
18
|
-
return this.values().length;
|
|
19
|
-
}
|
|
20
|
-
has(indi) {
|
|
21
|
-
return !!this.item((typeof indi === "string" ? indi : (indi?.id ?? "")));
|
|
22
|
-
}
|
|
23
|
-
get(name) {
|
|
24
|
-
const propList = new List();
|
|
25
|
-
this.entries().forEach(([key, item]) => {
|
|
26
|
-
propList.item(key, item.get(name));
|
|
27
|
-
});
|
|
28
|
-
return propList;
|
|
29
|
-
}
|
|
30
|
-
getIf(name, condition, name2) {
|
|
31
|
-
const propList = new List();
|
|
32
|
-
this.entries().forEach(([key, item]) => {
|
|
33
|
-
const passedItem = item.getIf(name, condition, name2);
|
|
34
|
-
if (passedItem) {
|
|
35
|
-
propList.item(key, passedItem);
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
return propList;
|
|
39
|
-
}
|
|
40
|
-
keys() {
|
|
41
|
-
// const hasOwn = Object.prototype.hasOwnProperty;
|
|
42
|
-
// const keys: K[] = [];
|
|
43
|
-
// for (const k in this.items) {
|
|
44
|
-
// if (hasOwn.call(this.items, k)) {
|
|
45
|
-
// keys.push(k);
|
|
46
|
-
// }
|
|
47
|
-
// }
|
|
48
|
-
// return keys;
|
|
49
|
-
return Object.keys(this.items);
|
|
50
|
-
}
|
|
51
|
-
values() {
|
|
52
|
-
// const hasOwn = Object.prototype.hasOwnProperty;
|
|
53
|
-
// const values: Array<T | undefined> = [];
|
|
54
|
-
// for (const k in this.items) {
|
|
55
|
-
// if (hasOwn.call(this.items, k)) {
|
|
56
|
-
// values.push(this.items[k]);
|
|
57
|
-
// }
|
|
58
|
-
// }
|
|
59
|
-
// return values;
|
|
60
|
-
return Object.values(this.items);
|
|
61
|
-
}
|
|
62
|
-
entries() {
|
|
63
|
-
// const hasOwn = Object.prototype.hasOwnProperty;
|
|
64
|
-
// const entries: Array<[K, T | undefined]> = [];
|
|
65
|
-
// for (const k in this.items) {
|
|
66
|
-
// if (hasOwn.call(this.items, k)) {
|
|
67
|
-
// entries.push([k, this.items[k]]);
|
|
68
|
-
// }
|
|
69
|
-
// }
|
|
70
|
-
// return entries;
|
|
71
|
-
return Object.entries(this.items);
|
|
72
|
-
}
|
|
73
|
-
setLength(_type) {
|
|
74
|
-
// THIS IS TO SLOW
|
|
75
|
-
// if (!type) {
|
|
76
|
-
// this.length = this.keys().length;
|
|
77
|
-
// } else {
|
|
78
|
-
// this.length = this.length + (type === "increase" ? 1 : -1);
|
|
79
|
-
// }
|
|
80
|
-
}
|
|
81
|
-
first() {
|
|
82
|
-
return this.index(0);
|
|
83
|
-
}
|
|
84
|
-
last() {
|
|
85
|
-
return this.index(this.keys().length - 1);
|
|
86
|
-
}
|
|
87
|
-
index(index) {
|
|
88
|
-
const keys = this.keys();
|
|
89
|
-
const key = keys[index];
|
|
90
|
-
return key && this.items[key];
|
|
91
|
-
}
|
|
92
|
-
item(name, value) {
|
|
93
|
-
if (arguments.length > 1) {
|
|
94
|
-
set(this.items, name, value);
|
|
95
|
-
this.setLength();
|
|
96
|
-
}
|
|
97
|
-
return get(this.items, name);
|
|
98
|
-
}
|
|
99
|
-
removeItem(name) {
|
|
100
|
-
unset(this.items, name);
|
|
101
|
-
this.setLength();
|
|
102
|
-
}
|
|
103
|
-
exclude(excludedList) {
|
|
104
|
-
excludedList.keys().forEach((itemId) => {
|
|
105
|
-
delete this.items[itemId];
|
|
106
|
-
});
|
|
107
|
-
this.setLength();
|
|
108
|
-
return this;
|
|
109
|
-
}
|
|
110
|
-
concat(items) {
|
|
111
|
-
if (Array.isArray(items)) {
|
|
112
|
-
items.forEach((item) => {
|
|
113
|
-
this.append(item);
|
|
114
|
-
});
|
|
115
|
-
}
|
|
116
|
-
else {
|
|
117
|
-
Object.assign(this.items, items ?? {});
|
|
118
|
-
}
|
|
119
|
-
this.setLength();
|
|
120
|
-
return this;
|
|
121
|
-
}
|
|
122
|
-
merge(mergedList) {
|
|
123
|
-
this.concat(mergedList?.items);
|
|
124
|
-
return this;
|
|
125
|
-
}
|
|
126
|
-
intersection(mergedList) {
|
|
127
|
-
const inter = intersectionBy(this.values(), mergedList?.values() ?? [], "id");
|
|
128
|
-
return new List(inter);
|
|
129
|
-
}
|
|
130
|
-
difference(mergedList) {
|
|
131
|
-
const inter = differenceBy(this.values(), mergedList?.values() ?? [], "id");
|
|
132
|
-
return new List(inter);
|
|
133
|
-
}
|
|
134
|
-
prepend(item) {
|
|
135
|
-
if (item.id) {
|
|
136
|
-
let increase = true;
|
|
137
|
-
if (this.items[item.id]) {
|
|
138
|
-
delete this.items[item.id];
|
|
139
|
-
increase = false;
|
|
140
|
-
}
|
|
141
|
-
this.items = Object.assign({
|
|
142
|
-
[item.id]: item,
|
|
143
|
-
}, this.items);
|
|
144
|
-
if (increase) {
|
|
145
|
-
this.setLength("increase");
|
|
146
|
-
}
|
|
147
|
-
}
|
|
148
|
-
return this;
|
|
149
|
-
}
|
|
150
|
-
append(item) {
|
|
151
|
-
if (item.id) {
|
|
152
|
-
let increase = true;
|
|
153
|
-
if (this.items[item.id]) {
|
|
154
|
-
delete this.items[item.id];
|
|
155
|
-
increase = false;
|
|
156
|
-
}
|
|
157
|
-
this.items[item.id] = item;
|
|
158
|
-
if (increase) {
|
|
159
|
-
this.setLength("increase");
|
|
160
|
-
}
|
|
161
|
-
}
|
|
162
|
-
return this;
|
|
163
|
-
}
|
|
164
|
-
delete(item) {
|
|
165
|
-
if (item.id && this.items[item.id]) {
|
|
166
|
-
delete this.items[item.id];
|
|
167
|
-
this.setLength("decrease");
|
|
168
|
-
}
|
|
169
|
-
return this;
|
|
170
|
-
}
|
|
171
|
-
copy(ClassName = (List)) {
|
|
172
|
-
const newList = new ClassName();
|
|
173
|
-
Object.assign(newList.items, this.items);
|
|
174
|
-
newList.setLength();
|
|
175
|
-
return newList;
|
|
176
|
-
}
|
|
177
|
-
except(item, ClassName = (List)) {
|
|
178
|
-
return this.copy(ClassName).delete(item);
|
|
179
|
-
}
|
|
180
|
-
forEach(iterate) {
|
|
181
|
-
this.entries().forEach(([key, item], index) => {
|
|
182
|
-
iterate(item, key, index);
|
|
183
|
-
});
|
|
184
|
-
}
|
|
185
|
-
map(iterate) {
|
|
186
|
-
return this.entries().map(([key, item], index) => {
|
|
187
|
-
return iterate(item, key, index);
|
|
188
|
-
});
|
|
189
|
-
}
|
|
190
|
-
reduce(iterate, initialValue) {
|
|
191
|
-
return this.entries().reduce((acc, [key, item], index) => {
|
|
192
|
-
return iterate(acc, item, key, index);
|
|
193
|
-
}, initialValue);
|
|
194
|
-
}
|
|
195
|
-
filter(filters, ClassName = (List)) {
|
|
196
|
-
const newList = new ClassName();
|
|
197
|
-
const isIterator = typeof filters === "function";
|
|
198
|
-
this.entries().forEach(([itemId, item], index) => {
|
|
199
|
-
if (isIterator) {
|
|
200
|
-
filters(item, itemId, index) && newList.item(itemId, item);
|
|
201
|
-
return;
|
|
202
|
-
}
|
|
203
|
-
if (!Object.keys(filters).length ||
|
|
204
|
-
Object.entries(filters).every(([key, value]) => {
|
|
205
|
-
let itemValue;
|
|
206
|
-
if (key === "id") {
|
|
207
|
-
// id is a special prop. it's always a string
|
|
208
|
-
itemValue = item.toProp("id");
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
itemValue = item.toProp(key)?.toValue();
|
|
212
|
-
}
|
|
213
|
-
if (Array.isArray(value)) {
|
|
214
|
-
return value.includes(itemValue);
|
|
215
|
-
}
|
|
216
|
-
return itemValue === value;
|
|
217
|
-
})) {
|
|
218
|
-
newList.item(itemId, item);
|
|
219
|
-
}
|
|
220
|
-
});
|
|
221
|
-
return newList;
|
|
222
|
-
}
|
|
223
|
-
find(filters, _ClassName = (List)) {
|
|
224
|
-
let foundItem;
|
|
225
|
-
const isIterator = typeof filters === "function";
|
|
226
|
-
this.entries().find(([itemId, item], index) => {
|
|
227
|
-
if (isIterator) {
|
|
228
|
-
if (filters(item, itemId, index)) {
|
|
229
|
-
foundItem = item;
|
|
230
|
-
return true;
|
|
231
|
-
}
|
|
232
|
-
return false;
|
|
233
|
-
}
|
|
234
|
-
if (!Object.keys(filters).length ||
|
|
235
|
-
Object.entries(filters).every(([key, value]) => {
|
|
236
|
-
let itemValue;
|
|
237
|
-
if (key === "id") {
|
|
238
|
-
// id is a special prop. it's always a string
|
|
239
|
-
itemValue = item.toProp("id");
|
|
240
|
-
}
|
|
241
|
-
else {
|
|
242
|
-
itemValue = item.toProp(key)?.toValue();
|
|
243
|
-
}
|
|
244
|
-
if (Array.isArray(value)) {
|
|
245
|
-
return value.includes(itemValue);
|
|
246
|
-
}
|
|
247
|
-
return itemValue === value;
|
|
248
|
-
})) {
|
|
249
|
-
foundItem = item;
|
|
250
|
-
return true;
|
|
251
|
-
}
|
|
252
|
-
return false;
|
|
253
|
-
});
|
|
254
|
-
return foundItem;
|
|
255
|
-
}
|
|
256
|
-
orderBy(orders, ClassName = (List)) {
|
|
257
|
-
const newList = new ClassName();
|
|
258
|
-
const isIterator = typeof orders === "function";
|
|
259
|
-
if (!isIterator && (!orders || !Object.keys(orders).length)) {
|
|
260
|
-
return newList.merge(this);
|
|
261
|
-
}
|
|
262
|
-
const sortedItems = this.entries().toSorted(([itemAId, itemA], [itemBId, itemB]) => {
|
|
263
|
-
if (isIterator) {
|
|
264
|
-
return orders(itemA, itemAId, itemB, itemBId);
|
|
265
|
-
}
|
|
266
|
-
const [key, { direction, getter }] = Object.entries(typeof orders === "string"
|
|
267
|
-
? { [orders]: { direction: "ASC" } }
|
|
268
|
-
: orders)[0];
|
|
269
|
-
const rawA = itemA.get(key);
|
|
270
|
-
const rawB = itemB.get(key);
|
|
271
|
-
let valueA = rawA?.toValue();
|
|
272
|
-
let valueB = rawB?.toValue();
|
|
273
|
-
if (getter && typeof getter === "function") {
|
|
274
|
-
valueA = getter(valueA, rawA);
|
|
275
|
-
valueB = getter(valueB, rawB);
|
|
276
|
-
}
|
|
277
|
-
let sortValue = 0;
|
|
278
|
-
if (!valueA && valueA !== 0 && !valueB && valueB !== 0) {
|
|
279
|
-
sortValue = 0;
|
|
280
|
-
}
|
|
281
|
-
else if (!valueB && valueB !== 0) {
|
|
282
|
-
sortValue = 1;
|
|
283
|
-
}
|
|
284
|
-
else if (!valueA && valueA !== 0) {
|
|
285
|
-
sortValue = -1;
|
|
286
|
-
}
|
|
287
|
-
else if (valueA < valueB) {
|
|
288
|
-
sortValue = -1;
|
|
289
|
-
}
|
|
290
|
-
else if (valueA > valueB) {
|
|
291
|
-
sortValue = 1;
|
|
292
|
-
}
|
|
293
|
-
return sortValue * (direction === "DESC" ? -1 : 1);
|
|
294
|
-
});
|
|
295
|
-
sortedItems.forEach(([key, value]) => {
|
|
296
|
-
newList.item(key, value);
|
|
297
|
-
});
|
|
298
|
-
return newList;
|
|
299
|
-
}
|
|
300
|
-
groupBy(groups, sort, minOccurance = -1, lessOccuranceLabel = "Appearing less than 5 times", ClassName = (List)) {
|
|
301
|
-
const groupped = {};
|
|
302
|
-
const isIterator = typeof groups === "function";
|
|
303
|
-
if (!isIterator && (!groups || !Object.keys(groups).length)) {
|
|
304
|
-
groupped.Unknown = new ClassName().merge(this);
|
|
305
|
-
groupped.Unknown.marker = "Unknown";
|
|
306
|
-
return groupped;
|
|
307
|
-
}
|
|
308
|
-
this.forEach((item, itemId) => {
|
|
309
|
-
const group = [];
|
|
310
|
-
if (isIterator) {
|
|
311
|
-
const newGroups = groups(item, itemId);
|
|
312
|
-
group.push(...(Array.isArray(newGroups) ? newGroups : [newGroups]));
|
|
313
|
-
}
|
|
314
|
-
else {
|
|
315
|
-
const [key, { getter }] = Object.entries(typeof groups === "string" ? { [groups]: {} } : groups)[0];
|
|
316
|
-
const raw = item
|
|
317
|
-
.get(key)
|
|
318
|
-
?.toList()
|
|
319
|
-
.index(0);
|
|
320
|
-
let value = raw?.toValue();
|
|
321
|
-
if (getter && typeof getter === "function") {
|
|
322
|
-
value = getter(value, raw);
|
|
323
|
-
}
|
|
324
|
-
if (value) {
|
|
325
|
-
group.push(value);
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
if (!group.length) {
|
|
329
|
-
group.push("Unknown");
|
|
330
|
-
}
|
|
331
|
-
group.forEach((g) => {
|
|
332
|
-
const newGroup = typeof g === "string" ? { group: g } : g;
|
|
333
|
-
if (!groupped[newGroup.group]) {
|
|
334
|
-
groupped[newGroup.group] = new ClassName();
|
|
335
|
-
groupped[newGroup.group].marker =
|
|
336
|
-
newGroup.marker ?? newGroup.group;
|
|
337
|
-
}
|
|
338
|
-
groupped[newGroup.group]?.append(item);
|
|
339
|
-
});
|
|
340
|
-
});
|
|
341
|
-
if (sort) {
|
|
342
|
-
return Object.entries(groupped)
|
|
343
|
-
.toSorted(([ak, a], [bk, b]) => {
|
|
344
|
-
if (typeof sort === "function") {
|
|
345
|
-
return sort(a, ak, b, bk);
|
|
346
|
-
}
|
|
347
|
-
if (ak === "Unknown") {
|
|
348
|
-
return 1;
|
|
349
|
-
}
|
|
350
|
-
if (bk === "Unknown") {
|
|
351
|
-
return -1;
|
|
352
|
-
}
|
|
353
|
-
if (sort === "group") {
|
|
354
|
-
return ak.localeCompare(bk);
|
|
355
|
-
}
|
|
356
|
-
return (b?.length ?? 0) - (a?.length ?? 0);
|
|
357
|
-
})
|
|
358
|
-
.reduce((acc, [key, value]) => {
|
|
359
|
-
if (minOccurance > -1 &&
|
|
360
|
-
(value?.length ?? 0) < minOccurance) {
|
|
361
|
-
const otherKey = lessOccuranceLabel;
|
|
362
|
-
acc[otherKey] =
|
|
363
|
-
acc[otherKey] && value
|
|
364
|
-
? acc[otherKey].merge(value)
|
|
365
|
-
: value;
|
|
366
|
-
}
|
|
367
|
-
else {
|
|
368
|
-
acc[key] = value;
|
|
369
|
-
}
|
|
370
|
-
return acc;
|
|
371
|
-
}, {});
|
|
372
|
-
}
|
|
373
|
-
return groupped;
|
|
374
|
-
}
|
|
375
|
-
findIndex(item) {
|
|
376
|
-
if (!item?.id) {
|
|
377
|
-
return -1;
|
|
378
|
-
}
|
|
379
|
-
return this.keys().findIndex((key) => key === item.id);
|
|
380
|
-
}
|
|
381
|
-
getItems() {
|
|
382
|
-
return this.items;
|
|
383
|
-
}
|
|
384
|
-
toJson(tag, options) {
|
|
385
|
-
const json = this.toObject(tag, options);
|
|
386
|
-
return JSON.stringify(json);
|
|
387
|
-
}
|
|
388
|
-
toObject(tag, options) {
|
|
389
|
-
const json = {};
|
|
390
|
-
this.entries().forEach(([_, item]) => {
|
|
391
|
-
const validTag = getValidTag(tag);
|
|
392
|
-
if (json[validTag]) {
|
|
393
|
-
if (!Array.isArray(json[validTag])) {
|
|
394
|
-
json[validTag] = [json[validTag]];
|
|
395
|
-
}
|
|
396
|
-
json[validTag].push(item.toObject(validTag, options));
|
|
397
|
-
}
|
|
398
|
-
else {
|
|
399
|
-
json[validTag] = item.toObject(validTag, options);
|
|
400
|
-
}
|
|
401
|
-
});
|
|
402
|
-
return json;
|
|
403
|
-
}
|
|
404
|
-
toGedcom(tag, level = 0, options) {
|
|
405
|
-
const gedcom = this.toGedcomLines(tag, level, options);
|
|
406
|
-
return gedcom.join("\n");
|
|
407
|
-
}
|
|
408
|
-
toGedcomLines(tag, level = 0, options) {
|
|
409
|
-
const gedcom = [];
|
|
410
|
-
this.entries().forEach(([_, item]) => {
|
|
411
|
-
const validTag = getValidTag(tag);
|
|
412
|
-
const validKey = item.id;
|
|
413
|
-
const validValue = validKey ? validTag : item.exportValue();
|
|
414
|
-
gedcom.push(`${level} ${validKey || validTag}${validValue ? ` ${validValue}` : ""}`);
|
|
415
|
-
gedcom.push(...item.toGedcomLines(validTag, level + 1, options));
|
|
416
|
-
});
|
|
417
|
-
return gedcom;
|
|
418
|
-
}
|
|
419
|
-
toValue() {
|
|
420
|
-
const propList = new List();
|
|
421
|
-
this.entries().forEach(([key, item]) => {
|
|
422
|
-
propList.item(key, item?.toValue());
|
|
423
|
-
});
|
|
424
|
-
return propList;
|
|
425
|
-
}
|
|
426
|
-
// @deprecated use get instead
|
|
427
|
-
toProp(tag) {
|
|
428
|
-
return this.get(tag);
|
|
429
|
-
}
|
|
430
|
-
toList() {
|
|
431
|
-
return new List().concat(this.items);
|
|
432
|
-
}
|
|
433
|
-
toValueList() {
|
|
434
|
-
const newList = new List();
|
|
435
|
-
this.values().forEach((value) => {
|
|
436
|
-
value.value && newList.item(value.value, value);
|
|
437
|
-
});
|
|
438
|
-
return newList;
|
|
439
|
-
}
|
|
440
|
-
}
|
package/dist/classes/name.d.ts
DELETED
|
@@ -1,20 +0,0 @@
|
|
|
1
|
-
import type { IdType } from "../types/types";
|
|
2
|
-
import { Common } from "./common";
|
|
3
|
-
import type { ProxyOriginal } from "./common";
|
|
4
|
-
import type { GedComType } from "./gedcom";
|
|
5
|
-
export declare class CommonName extends Common<string> {
|
|
6
|
-
NPFX?: Common;
|
|
7
|
-
GIVN?: Common;
|
|
8
|
-
NICK?: Common;
|
|
9
|
-
SPFX?: Common;
|
|
10
|
-
SURN?: Common;
|
|
11
|
-
NSFX?: Common;
|
|
12
|
-
DISPLAY?: Common;
|
|
13
|
-
_MARNM?: Common;
|
|
14
|
-
constructor(gedcom?: GedComType, id?: IdType, main?: Common, parent?: Common);
|
|
15
|
-
set value(value: string | undefined);
|
|
16
|
-
get value(): string | undefined;
|
|
17
|
-
name(value: string | undefined): this;
|
|
18
|
-
}
|
|
19
|
-
export declare const createCommonName: (gedcom?: GedComType, id?: IdType, main?: Common, parent?: Common) => ProxyOriginal<CommonName>;
|
|
20
|
-
//# sourceMappingURL=name.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"name.d.ts","sourceRoot":"","sources":["../../src/classes/name.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAA6B,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGzC,qBAAa,UAAW,SAAQ,MAAM,CAAC,MAAM,CAAC;IAC7C,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;gBAGf,MAAM,CAAC,EAAE,UAAU,EACnB,EAAE,CAAC,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM;IAOhB,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EAoClC;IAED,IAAI,KAAK,IAtCQ,MAAM,GAAG,SAAS,CA4ClC;IAED,IAAI,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS;CAK9B;AAED,eAAO,MAAM,gBAAgB,GAC5B,SAAS,UAAU,EACnB,KAAK,MAAM,EACX,OAAO,MAAM,EACb,SAAS,MAAM,KACb,aAAa,CAAC,UAAU,CAI1B,CAAC"}
|
package/dist/classes/name.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import { Common, createCommon, createProxy } from "./common.js";
|
|
2
|
-
import { Indi } from "./indi.js";
|
|
3
|
-
export class CommonName extends Common {
|
|
4
|
-
constructor(gedcom, id, main, parent) {
|
|
5
|
-
super(gedcom, id, main, parent);
|
|
6
|
-
delete this.id;
|
|
7
|
-
}
|
|
8
|
-
set value(value) {
|
|
9
|
-
if (value && this._main instanceof Indi) {
|
|
10
|
-
const nameParts = value.match(/(?<givenname>[^/]*)(\/(?<surname>[^/]*)\/)?(?<suffix>.*)$/)?.groups;
|
|
11
|
-
if (nameParts?.givenname?.trim()) {
|
|
12
|
-
this.GIVN =
|
|
13
|
-
this.GIVN ||
|
|
14
|
-
createCommon(this._gedcom, undefined, this.main);
|
|
15
|
-
this.GIVN.isListable = false;
|
|
16
|
-
this.GIVN.value = nameParts.givenname.trim();
|
|
17
|
-
}
|
|
18
|
-
if (nameParts?.surname?.trim()) {
|
|
19
|
-
this.SURN =
|
|
20
|
-
this.SURN ||
|
|
21
|
-
createCommon(this._gedcom, undefined, this.main);
|
|
22
|
-
this.SURN.value = nameParts.surname.trim();
|
|
23
|
-
this.SURN.isListable = false;
|
|
24
|
-
}
|
|
25
|
-
if (nameParts?.suffix?.trim()) {
|
|
26
|
-
this.NSFX =
|
|
27
|
-
this.NSFX ||
|
|
28
|
-
createCommon(this._gedcom, undefined, this.main);
|
|
29
|
-
this.NSFX.value = nameParts.suffix.trim();
|
|
30
|
-
this.NSFX.isListable = false;
|
|
31
|
-
}
|
|
32
|
-
}
|
|
33
|
-
this._value = value;
|
|
34
|
-
}
|
|
35
|
-
get value() {
|
|
36
|
-
if (this._value === undefined && this.DISPLAY?.value) {
|
|
37
|
-
return this.DISPLAY?.value;
|
|
38
|
-
}
|
|
39
|
-
return this._value;
|
|
40
|
-
}
|
|
41
|
-
name(value) {
|
|
42
|
-
this.value = value;
|
|
43
|
-
return this;
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
export const createCommonName = (gedcom, id, main, parent) => {
|
|
47
|
-
return createProxy(new CommonName(gedcom, id, main, parent));
|
|
48
|
-
};
|
package/dist/classes/note.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type { IdType } from "../types/types";
|
|
2
|
-
import { Common } from "./common";
|
|
3
|
-
import type { ProxyOriginal } from "./common";
|
|
4
|
-
import type { GedComType } from "./gedcom";
|
|
5
|
-
export declare class CommonNote extends Common<string> {
|
|
6
|
-
constructor(gedcom?: GedComType, id?: IdType, main?: Common, parent?: Common);
|
|
7
|
-
set value(value: string | undefined);
|
|
8
|
-
get value(): string | undefined;
|
|
9
|
-
exportValue(): string;
|
|
10
|
-
}
|
|
11
|
-
export declare const createCommonNote: (gedcom?: GedComType, id?: IdType, main?: Common, parent?: Common) => ProxyOriginal<CommonNote>;
|
|
12
|
-
//# sourceMappingURL=note.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"note.d.ts","sourceRoot":"","sources":["../../src/classes/note.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,gBAAgB,CAAC;AAE7C,OAAO,EAAE,MAAM,EAA6B,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAGzC,qBAAa,UAAW,SAAQ,MAAM,CAAC,MAAM,CAAC;gBAE5C,MAAM,CAAC,EAAE,UAAU,EACnB,EAAE,CAAC,EAAE,MAAM,EACX,IAAI,CAAC,EAAE,MAAM,EACb,MAAM,CAAC,EAAE,MAAM;IAOhB,IAAI,KAAK,CAAC,KAAK,EAAE,MAAM,GAAG,SAAS,EA4BlC;IAED,IAAI,KAAK,IA9BQ,MAAM,GAAG,SAAS,CAyClC;IAED,WAAW;CAGX;AAED,eAAO,MAAM,gBAAgB,GAC5B,SAAS,UAAU,EACnB,KAAK,MAAM,EACX,OAAO,MAAM,EACb,SAAS,MAAM,KACb,aAAa,CAAC,UAAU,CAI1B,CAAC"}
|
package/dist/classes/note.js
DELETED
|
@@ -1,46 +0,0 @@
|
|
|
1
|
-
import { Common, createCommon, createProxy } from "./common.js";
|
|
2
|
-
import { List } from "./list.js";
|
|
3
|
-
export class CommonNote extends Common {
|
|
4
|
-
constructor(gedcom, id, main, parent) {
|
|
5
|
-
super(gedcom, id, main, parent);
|
|
6
|
-
delete this.id;
|
|
7
|
-
}
|
|
8
|
-
set value(value) {
|
|
9
|
-
const [note, ...contents] = value?.split(/\r?\n/) ?? [];
|
|
10
|
-
this._value = note;
|
|
11
|
-
if (contents.length) {
|
|
12
|
-
const newContents = new List();
|
|
13
|
-
contents.forEach((c, i) => {
|
|
14
|
-
const newContent = createCommon(this._gedcom, undefined, this.main);
|
|
15
|
-
newContent.id = `@U${i}@`;
|
|
16
|
-
newContent.value = c;
|
|
17
|
-
newContents.append(newContent);
|
|
18
|
-
});
|
|
19
|
-
const firstItem = newContents.index(0);
|
|
20
|
-
if (firstItem) {
|
|
21
|
-
if (newContents.length === 1) {
|
|
22
|
-
this.set("CONT", firstItem);
|
|
23
|
-
}
|
|
24
|
-
else {
|
|
25
|
-
this.set("CONT", newContents);
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
get value() {
|
|
31
|
-
const contents = this.get("CONT")
|
|
32
|
-
?.toList()
|
|
33
|
-
.map((content) => content.value)
|
|
34
|
-
.join("\n");
|
|
35
|
-
if (contents) {
|
|
36
|
-
return `${this._value}\n${contents}`;
|
|
37
|
-
}
|
|
38
|
-
return this._value;
|
|
39
|
-
}
|
|
40
|
-
exportValue() {
|
|
41
|
-
return this._value;
|
|
42
|
-
}
|
|
43
|
-
}
|
|
44
|
-
export const createCommonNote = (gedcom, id, main, parent) => {
|
|
45
|
-
return createProxy(new CommonNote(gedcom, id, main, parent));
|
|
46
|
-
};
|
package/dist/classes/obje.d.ts
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import type IObje from "../interfaces/obje";
|
|
2
|
-
import type IMultimediaLinkStructure from "../structures/multimedia-link";
|
|
3
|
-
import type { ObjeKey } from "../types/types";
|
|
4
|
-
import { Common } from "./common";
|
|
5
|
-
import type { ProxyOriginal } from "./common";
|
|
6
|
-
import type { GedComType } from "./gedcom";
|
|
7
|
-
export declare class Obje extends Common<string, ObjeKey> implements IObje {
|
|
8
|
-
standardizeMedia(namespace?: string | number, override?: boolean, urlGetter?: (namespace?: string | number, imgId?: string) => string | undefined): this | ProxyOriginal<ObjeType>;
|
|
9
|
-
}
|
|
10
|
-
export type ObjeType = Obje & IMultimediaLinkStructure;
|
|
11
|
-
export declare const createObje: (gedcom: GedComType, id?: ObjeKey, main?: Common, parent?: Common) => ProxyOriginal<ObjeType>;
|
|
12
|
-
//# sourceMappingURL=obje.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"obje.d.ts","sourceRoot":"","sources":["../../src/classes/obje.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,oBAAoB,CAAC;AAC5C,OAAO,KAAK,wBAAwB,MAAM,+BAA+B,CAAC;AAC1E,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,MAAM,EAA6B,MAAM,UAAU,CAAC;AAC7D,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AAC9C,OAAO,KAAK,EAAC,UAAU,EAAC,MAAM,UAAU,CAAC;AAEzC,qBAAa,IAAK,SAAQ,MAAM,CAAC,MAAM,EAAE,OAAO,CAAE,YAAW,KAAK;IACjE,gBAAgB,CACf,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAC3B,QAAQ,UAAO,EACf,SAAS,CAAC,EAAE,CACX,SAAS,CAAC,EAAE,MAAM,GAAG,MAAM,EAC3B,KAAK,CAAC,EAAE,MAAM,KACV,MAAM,GAAG,SAAS;CAsGxB;AAED,MAAM,MAAM,QAAQ,GAAG,IAAI,GAAG,wBAAwB,CAAC;AACvD,eAAO,MAAM,UAAU,GACtB,QAAQ,UAAU,EAClB,KAAK,OAAO,EACZ,OAAO,MAAM,EACb,SAAS,MAAM,KACb,aAAa,CAAC,QAAQ,CAIxB,CAAC"}
|
package/dist/classes/obje.js
DELETED
|
@@ -1,81 +0,0 @@
|
|
|
1
|
-
import { Common, createCommon, createProxy } from "./common.js";
|
|
2
|
-
export class Obje extends Common {
|
|
3
|
-
standardizeMedia(namespace, override = true, urlGetter) {
|
|
4
|
-
if (!this._gedcom) {
|
|
5
|
-
return this;
|
|
6
|
-
}
|
|
7
|
-
const rin = this?.get("RIN")?.toValue();
|
|
8
|
-
const clone = this?.get("_CLON._OID")?.toValue();
|
|
9
|
-
const mser = this?.get("_MSER._LKID")?.toValue();
|
|
10
|
-
const title = this?.get("FILE.TITL")?.toValue() ??
|
|
11
|
-
this?.get("TITL")?.toValue() ??
|
|
12
|
-
"";
|
|
13
|
-
const note = this?.get("FILE.NOTE")?.toValue() ??
|
|
14
|
-
this?.get("NOTE")?.toValue() ??
|
|
15
|
-
"";
|
|
16
|
-
const form = this?.get("FILE.FORM")?.toValue();
|
|
17
|
-
const file = this?.get("FILE")?.toValue();
|
|
18
|
-
const imgId = rin || clone || mser;
|
|
19
|
-
const url = file || (namespace && urlGetter?.(namespace, imgId));
|
|
20
|
-
if (!url) {
|
|
21
|
-
return this;
|
|
22
|
-
}
|
|
23
|
-
const newObject = createObje(this._gedcom, this.id, this.main);
|
|
24
|
-
if (!override) {
|
|
25
|
-
Object.assign(newObject, this);
|
|
26
|
-
}
|
|
27
|
-
if (form) {
|
|
28
|
-
if (typeof form === "string") {
|
|
29
|
-
const newForm = createCommon(this._gedcom, undefined, this.main);
|
|
30
|
-
newForm.value = form;
|
|
31
|
-
newObject.set("FORM", newForm);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
newObject.set("FORM", form);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
if (title) {
|
|
38
|
-
if (typeof title === "string") {
|
|
39
|
-
const newTitle = createCommon(this._gedcom, undefined, this.main);
|
|
40
|
-
newTitle.value = title;
|
|
41
|
-
newObject.set("TITL", newTitle);
|
|
42
|
-
if (!note) {
|
|
43
|
-
newObject.set("NOTE", newTitle);
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
newObject.set("TITL", title);
|
|
48
|
-
if (!note) {
|
|
49
|
-
newObject.set("NOTE", title);
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
if (note) {
|
|
54
|
-
if (typeof note === "string") {
|
|
55
|
-
const newNote = createCommon(this._gedcom, undefined, this.main);
|
|
56
|
-
newNote.value = note;
|
|
57
|
-
newObject.set("NOTE", newNote);
|
|
58
|
-
if (!title) {
|
|
59
|
-
newObject.set("TITL", newNote);
|
|
60
|
-
}
|
|
61
|
-
}
|
|
62
|
-
else {
|
|
63
|
-
newObject.set("NOTE", note);
|
|
64
|
-
if (!title) {
|
|
65
|
-
newObject.set("TITL", note);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
}
|
|
69
|
-
const newUrl = createCommon(this._gedcom, undefined, this.main);
|
|
70
|
-
newUrl.value = url;
|
|
71
|
-
newObject.set("FILE", newUrl);
|
|
72
|
-
if (override) {
|
|
73
|
-
Object.assign(this, newObject);
|
|
74
|
-
return this;
|
|
75
|
-
}
|
|
76
|
-
return newObject;
|
|
77
|
-
}
|
|
78
|
-
}
|
|
79
|
-
export const createObje = (gedcom, id, main, parent) => {
|
|
80
|
-
return createProxy(new Obje(gedcom, id, main, parent));
|
|
81
|
-
};
|
package/dist/classes/objes.d.ts
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import type { ObjeKey } from "../types/types";
|
|
2
|
-
import { List } from "./list";
|
|
3
|
-
import type { ObjeType } from "./obje";
|
|
4
|
-
export declare class Objects extends List<ObjeKey, ObjeType> {
|
|
5
|
-
copy(): Objects;
|
|
6
|
-
except(item: ObjeType): Objects;
|
|
7
|
-
}
|
|
8
|
-
//# sourceMappingURL=objes.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"objes.d.ts","sourceRoot":"","sources":["../../src/classes/objes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAC,OAAO,EAAC,MAAM,gBAAgB,CAAC;AAE5C,OAAO,EAAE,IAAI,EAAE,MAAM,QAAQ,CAAC;AAC9B,OAAO,KAAK,EAAC,QAAQ,EAAC,MAAM,QAAQ,CAAC;AAErC,qBAAa,OAAQ,SAAQ,IAAI,CAAC,OAAO,EAAE,QAAQ,CAAC;IACnD,IAAI;IAUJ,MAAM,CAAC,IAAI,EAAE,QAAQ;CAGrB"}
|