Skip to main content

Interface: ParsedReference

Defined in: Services/ReferenceParser.ts:23

Reference Parser

Parses Bible references from text strings. Supports various formats:

  • "John 3:16" (single verse)
  • "John 3:16-17" (verse range in same chapter)
  • "John 3:16-4:2" (verse range across chapters)
  • "John 3" (entire chapter)
  • "John 3-5" (chapter range)
  • "1 John 3:16" (numbered books)
  • "Gen 1:1" (abbreviated names)
  • "Genesis 1:1" (full names)
  • "John 3:16, 17" (comma-separated verses)

Language-configurable: the constructor accepts optional book name tables and display names. English defaults are exported as constants so other Latin-script languages can provide their own tables while reusing the parsing logic. Languages with fundamentally different reference syntax (e.g., CJK) can implement the IReferenceParser interface directly.

Properties

book?

optional book?: number

Defined in: Services/ReferenceParser.ts:25


bookName?

optional bookName?: string

Defined in: Services/ReferenceParser.ts:26


chapter?

optional chapter?: number

Defined in: Services/ReferenceParser.ts:27


correctedBookName?

optional correctedBookName?: string

Defined in: Services/ReferenceParser.ts:33


endChapter?

optional endChapter?: number

Defined in: Services/ReferenceParser.ts:29


endVerse?

optional endVerse?: number

Defined in: Services/ReferenceParser.ts:30


fuzzyMatch?

optional fuzzyMatch?: boolean

Defined in: Services/ReferenceParser.ts:32


isValid

isValid: boolean

Defined in: Services/ReferenceParser.ts:24


originalText

originalText: string

Defined in: Services/ReferenceParser.ts:31


verse?

optional verse?: number

Defined in: Services/ReferenceParser.ts:28


wholeBook?

optional wholeBook?: boolean

Defined in: Services/ReferenceParser.ts:41

The reference names a book and nothing else ("John"), so it covers every chapter. chapter is 1 and verse/endChapter/endVerse are absent — the end is "wherever the book ends", which this parser has no chapter counts to state. Only ever set when ReferenceParseOptions.allowWholeBook is passed.