From 0831e82abbb7cc6f8c0949bdaf1ca2d66de46719 Mon Sep 17 00:00:00 2001 From: Ira Hopkinson Date: Mon, 9 Oct 2023 10:59:20 +1300 Subject: [PATCH] Improve `VerseRef.internalValid()` (#10) --- .vscode/settings.json | 13 ++++++++++++- README.md | 2 +- src/verse-ref.ts | 11 +++++++++-- 3 files changed, 22 insertions(+), 4 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 2fa8e5f..bd52575 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -12,5 +12,16 @@ "url": "http://json.schemastore.org/tsconfig" } ], - "cSpell.words": ["deutero", "otnt", "parseable"] + "cSpell.words": [ + "bbbccc", + "bbbcccvvv", + "bbbcccvvvs", + "codecov", + "deutero", + "libpalaso", + "otnt", + "parseable", + "sillsdev", + "vref" + ] } diff --git a/README.md b/README.md index c2dde8e..3d2db4f 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ v1 is a minimal partial port in TypeScript that supports use on the frontend whi ## Features -- {class} Canon - Canon information. Also, contains static information on complete list of books. +- {object} Canon - Canon information. Also, contains static information on complete list of books. - {class} VerseRef - Stores a reference to a specific verse in Scripture. - Represents a single reference, e.g. `'GEN 2:3'`. - Represents a reference range, e.g. `'LUK 3:4-5'`. diff --git a/src/verse-ref.ts b/src/verse-ref.ts index 8569ad7..dd06d09 100644 --- a/src/verse-ref.ts +++ b/src/verse-ref.ts @@ -140,12 +140,19 @@ export class VerseRef { return { success: true, vNum }; } + /** Not yet implemented. */ firstChapter?: number; + /** Not yet implemented. */ lastChapter?: number; + /** Not yet implemented. */ lastVerse?: number; + /** Not yet implemented. */ hasSegmentsDefined?: boolean; + /** Not yet implemented. */ text?: string; + /** Not yet implemented. */ BBBCCCVVVS?: string; + /** Not yet implemented. */ longHashCode?: number; /** The versification of the reference. */ versification?: ScrVers; @@ -577,13 +584,13 @@ export class VerseRef { return ValidStatusType.OutOfRange; } - // TODO: Finish the rest of the port required to uncomment the section below. // If non-biblical book, any chapter/verse is valid - /* if (!Canon.isCanonical(this._bookNum)) { return ValidStatusType.Valid; } + // TODO: Finish the rest of the port required to uncomment the section below. + /* if (this._bookNum > this._versification.getLastBook() || this._chapterNum <= 0 || this._chapterNum > this._versification.getLastChapter(this._bookNum) || this.verseNum < 0 || this.verseNum > this._versification.getLastVerse(this._bookNum, this._chapterNum)