@domorium/validator 2.0.1 → 2.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,21 @@
1
+ export type DateModifier = "ABT" | "CAL" | "EST" | "BEF" | "AFT" | "BET" | "FROM" | "TO" | "INT";
2
+ export interface GedcomDate {
3
+ /** In the GEDCOM 7 spelling, so 5.5.1's `FRENCH R` is `FRENCH_R`. */
4
+ calendar: string;
5
+ day?: number;
6
+ month?: string;
7
+ /** Counted in `calendar` and `epoch`: a Hebrew year is not a Gregorian one. */
8
+ year: number;
9
+ /** The year after `year`, where 5.5.1 writes both as `1750/51`. */
10
+ dualYear?: number;
11
+ /** `BCE` however 5.5.1 spells it, or an extension tag. */
12
+ epoch?: string;
13
+ }
14
+ export interface GedcomDateValue {
15
+ modifier?: DateModifier;
16
+ /** Two for `BET` and for a `FROM` that has a `TO`; none for a bare phrase. */
17
+ dates: GedcomDate[];
18
+ /** 5.5.1's parenthesised text, without the parentheses. */
19
+ phrase?: string;
20
+ text: string;
21
+ }
@@ -0,0 +1,10 @@
1
+ import { GedcomScheme } from "../schemes/schema-types";
2
+ import type { GedcomDateValue } from "../types/date";
3
+ export declare function isValidDatePeriod551(scheme: GedcomScheme, value: string): boolean;
4
+ export declare function isValidDateValue551(scheme: GedcomScheme, value: string): boolean;
5
+ /**
6
+ * `DATE_EXACT` is `<DAY> <MONTH> <YEAR_GREG>`: Gregorian, and no slot for a
7
+ * calendar, so an escape is not stripped before the grammar reads it.
8
+ */
9
+ export declare function isValidDateExact551(scheme: GedcomScheme, value: string): boolean;
10
+ export declare function readDateValue551(scheme: GedcomScheme, value: string): GedcomDateValue | null;
@@ -1,6 +1,8 @@
1
1
  import { GedcomScheme } from "../schemes/schema-types";
2
2
  import { ExtensionContext } from "./extensions";
3
+ import type { GedcomDateValue } from "../types/date";
3
4
  export declare function isValidDateValue(value: string, scheme: GedcomScheme, extensions?: ExtensionContext): boolean;
5
+ export declare function readDateValueV7(value: string, scheme: GedcomScheme, extensions?: ExtensionContext): GedcomDateValue | null;
4
6
  export declare function isValidDatePeriod(value: string, scheme: GedcomScheme, extensions?: ExtensionContext): boolean;
5
7
  /**
6
8
  * `DateExact` names no calendar and takes no epoch: it is day, month and year in
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@domorium/validator",
3
- "version": "2.0.1",
3
+ "version": "2.1.0",
4
4
  "description": "GEDCOM 5.5.1 and 7.0 parser and validator",
5
5
  "keywords": [
6
6
  "gedcom",
@@ -61,6 +61,6 @@
61
61
  "ts-brand": "^0.2.0"
62
62
  },
63
63
  "devDependencies": {
64
- "tsx": "^4.23.12"
64
+ "tsx": "^4.23.15"
65
65
  }
66
66
  }