A reference to a scripture chapter, verse, or verses.

new Reference("Genesis", 1, 1)

Constructors

  • Parameters

    • book: string | number
    • chapter: number
    • OptionalverseStart: number
    • OptionalverseEnd: number
    • Optionaltranslation: string

    Returns Reference

Properties

book: number
chapter: number
translation?: string
verseEnd?: number
verseStart?: number

Methods

  • Returns the English name of the book being referenced.

    Returns string

    let ref = new Reference("Malachi", 4)
    ref.getBookName() === "Malachi"
  • Returns the name of the book being referenced according to the current translation. (See Reference.getTranslation)

    Returns Promise<string>

  • Returns the TranslationID being referenced.

    Returns string

    If the translation is not defined in the reference, then returns the reading translation from the user's settings.

    let ref = new Reference("Genesis", 1, 1, 2, "WEB")
    ref.getTranslation() === "WEB"
  • Sets the book being referenced.

    Parameters

    • book: string | number

    Returns Reference

    let ref = new Reference("Psalms", 1)

    ref.setBook("1 John")
    ref.toString() === "1 John 1"

    ref.setBook(1)
    ref.toString() === "Genesis 1"
  • Sets the translation of the reference.

    Parameters

    • Optionaltranslation: string

    Returns Reference

  • Sets the verse being referenced

    Parameters

    • Optionalstart: number

    Returns Reference

    let ref = new Reference("Psalms", 119)

    ref.setVerse(1)
    ref.toString() === "Psalms 119:1"

    ref.setVerse()
    ref.toString() === "Psalms 119"
  • Sets the verse range being referenced.

    Parameters

    • Optionalstart: number
    • Optionalend: number

    Returns Reference

    let ref = new Reference("Psalms", 119)

    ref.setVerseRange(1)
    ref.toString() === "Psalms 119:1"

    ref.setVerseRange(2, 3)
    ref.toString() === "Psalms 119:2-3"

    ref.setVerseRange()
    ref.toString() === "Psalms 119"

    ReferenceError if end is defined but start is undefined.

  • Fetches the scripture being referenced as markdown.

    Parameters

    Returns Promise<string>

    let ref = new Reference("Genesis", 1, 1)
    let text = await ref.text()
    text.startsWith("In the beginning") === true
  • Converts this reference to a string.

    Returns Promise<string>

    let ref = new Reference("John", 33, 3, 4, "WEB")
    String(ref) === "John 33:3-4 WEB"