@domorium/validator 1.8.1 → 1.8.2
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/CHANGELOG.md +70 -0
- package/dist/index.cjs.js +2 -2
- package/dist/index.esm.js +372 -295
- package/dist/parser/lineIndex.d.ts +1 -0
- package/dist/validator/epoch.d.ts +11 -0
- package/dist/validator/rule-node.d.ts +1 -1
- package/dist/validator/validate.d.ts +3 -1
- package/package.json +1 -1
|
@@ -5,5 +5,6 @@ import type { Position } from "../types/position";
|
|
|
5
5
|
* per token, which is where most of a large document's memory went.
|
|
6
6
|
*/
|
|
7
7
|
export type LineIndex = Int32Array;
|
|
8
|
+
/** 5.5.1 ends a line with CR, LF, CR-LF or LF-CR. See #251. */
|
|
8
9
|
export declare function createLineIndex(text: string): LineIndex;
|
|
9
10
|
export declare function offsetToPosition(index: LineIndex, offset: number): Position;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 5.5.1 carries no epoch in `YEAR_GREG` at all. The only statement about one is
|
|
3
|
+
* prose — "A (B.C.) appended to the <YEAR> indicates a date before the birth of
|
|
4
|
+
* Christ" — with no dated example, so neither the spelling nor the delimiter is
|
|
5
|
+
* fixed, and exports write `BC`, `B.C.` and `BCE` alike. See issue #239.
|
|
6
|
+
*
|
|
7
|
+
* GEDCOM 7 pins its epoch in the schema, which date-v7.ts reads from there, so
|
|
8
|
+
* nothing below belongs to it.
|
|
9
|
+
*/
|
|
10
|
+
export declare const EPOCH_SRC = "(?:[Bb][Cc][Ee]|[Bb]\\.?[Cc]\\.?)";
|
|
11
|
+
export declare function isEpoch(token: string | undefined): boolean;
|
|
@@ -2,7 +2,7 @@ import { GedcomScheme, GedcomType } from "../schemes/schema-types";
|
|
|
2
2
|
import { ASTNode } from "../parser";
|
|
3
3
|
import { GedcomError } from "../types/errors";
|
|
4
4
|
import { ExtensionContext } from "./extensions";
|
|
5
|
-
type FieldType = "boolean" | "string" | "nonNegativeInteger" | "select" | "multiselect" | "date" | "date-v7" | "date-period" | "date-period-v7" | "date-exact" | "date-exact-v7" | "time" | "time-v7" | "pointer" | "age" | "personal-name" | "media-type" | "language-tag" | "tag-def" | null;
|
|
5
|
+
type FieldType = "boolean" | "string" | "nonNegativeInteger" | "select" | "multiselect" | "date" | "date-v7" | "date-period" | "date-period-v7" | "date-exact" | "date-exact-v7" | "time" | "time-v7" | "pointer" | "age" | "age-v7" | "personal-name" | "latitude" | "longitude" | "media-type" | "language-tag" | "tag-def" | null;
|
|
6
6
|
export declare class RuleNode {
|
|
7
7
|
private readonly scheme;
|
|
8
8
|
private readonly pointerMap;
|
|
@@ -12,5 +12,7 @@ export declare class GedcomValidator {
|
|
|
12
12
|
/** A fragment is not a document, so nothing is required of its root. */
|
|
13
13
|
fragment?: boolean);
|
|
14
14
|
setScheme(nodes: ASTNode[]): GedcomScheme;
|
|
15
|
-
validate(nodes: ASTNode[], parentType?: GedcomType, _scheme?: GedcomScheme
|
|
15
|
+
validate(nodes: ASTNode[], parentType?: GedcomType, _scheme?: GedcomScheme,
|
|
16
|
+
/** Absent at the root, where the start of the document is the honest place. */
|
|
17
|
+
parent?: ASTNode): GedcomError[];
|
|
16
18
|
}
|