Skip to content
Best Codes edited this page Sep 9, 2024 · 3 revisions

Usage

This page provides detailed information on how to use the various functions provided by the best-bible package.

Table of Contents

  1. getVerse
  2. getChapter
  3. getBook
  4. getRange
  5. getChapterCount
  6. getVerseCount
  7. getBibleBooks
  8. searchVerse
  9. resolveAbbreviation
  10. bibleStats
  11. bibleValidation

getVerse

getVerse(bookName, chapterNumber, verseNumber, outputType = "default")

Retrieves a specific verse from the Bible.

  • Parameters:

    • bookName (string): The name of the book containing the verse.
    • chapterNumber (number): The number of the chapter containing the verse.
    • verseNumber (number): The number of the verse to retrieve.
    • outputType (string, optional): The type of output format desired ("default", "indexed", or "string").
  • Returns: Array or string, depending on the outputType.

getChapter

getChapter(bookName, chapterNumber, outputType = "default")

Retrieves a specific chapter from the Bible.

  • Parameters:

    • bookName (string): The name of the book containing the chapter.
    • chapterNumber (number): The number of the chapter to retrieve.
    • outputType (string, optional): The type of output format desired ("default", "indexed", or "string").
  • Returns: Array or string, depending on the outputType.

getBook

getBook(bookName, outputType = "default")

Retrieves a specific book from the Bible.

  • Parameters:

    • bookName (string): The name of the book to retrieve.
    • outputType (string, optional): The type of output format desired ("default", "indexed", or "string").
  • Returns: Array, string, or object, depending on the outputType.

getRange

getRange(startBookName, startChapterNumber, startVerseNumber, endBookName, endChapterNumber, endVerseNumber, outputType = "default")

Retrieves a range of verses from the Bible.

  • Parameters:

    • startBookName (string): The name of the starting book.
    • startChapterNumber (number): The number of the starting chapter.
    • startVerseNumber (number): The number of the starting verse.
    • endBookName (string): The name of the ending book.
    • endChapterNumber (number): The number of the ending chapter.
    • endVerseNumber (number): The number of the ending verse.
    • outputType (string, optional): The type of output format desired ("default", "indexed", or "string").
  • Returns: Array or string, depending on the outputType.

getChapterCount

getChapterCount(bookName)

Retrieves the number of chapters in a specific book of the Bible.

  • Parameters:

    • bookName (string): The name of the book.
  • Returns: Number of chapters in the specified book.

getVerseCount

getVerseCount(bookName, chapterNumber)

Retrieves the number of verses in a specific chapter of a book in the Bible.

  • Parameters:

    • bookName (string): The name of the book.
    • chapterNumber (number): The number of the chapter.
  • Returns: Number of verses in the specified chapter.

getBibleBooks

getBibleBooks()

Retrieves the list of Bible books.

  • Returns: Array containing the names of all the Bible books.

searchVerse

searchVerse(query, caseSensitive = false, exactMatch = false, outputType = "indexed")

Searches for a query string in each verse of the Bible and returns the matching verses.

  • Parameters:

    • query (string): The query string to search for.
    • caseSensitive (boolean, optional): Whether the search should be case sensitive.
    • exactMatch (boolean, optional): Whether the search should match the exact phrase.
    • outputType (string, optional): The type of output format desired ("indexed" or "string").
  • Returns: Array or string of matching verses, depending on the outputType.

resolveAbbreviation

resolveAbbreviation(abbreviation)

Resolves an abbreviation to its full name.

  • Parameters:

    • abbreviation (string): The abbreviation to resolve.
  • Returns: The full name corresponding to the abbreviation.

bibleStats

bibleStats()

Returns an object containing the number of books, chapters, and verses in the Bible.

  • Returns: Object with the number of books, chapters, and verses in the Bible.

bibleValidation

The bibleValidation object provides three validation functions:

isValidBook

bibleValidation.isValidBook(bookName)

Checks if a book name is valid.

  • Parameters:

    • bookName (string): The name of the book to validate.
  • Returns: Boolean indicating whether the book name is valid.

isValidChapter

bibleValidation.isValidChapter(bookName, chapterNumber)

Checks if a chapter number is valid for a given book.

  • Parameters:

    • bookName (string): The name of the book.
    • chapterNumber (number): The chapter number to validate.
  • Returns: Boolean indicating whether the chapter number is valid for the given book.

isValidVerse

bibleValidation.isValidVerse(bookName, chapterNumber, verseNumber)

Checks if a verse number is valid for a given book and chapter.

  • Parameters:

    • bookName (string): The name of the book.
    • chapterNumber (number): The chapter number.
    • verseNumber (number): The verse number to validate.
  • Returns: Boolean indicating whether the verse number is valid for the given book and chapter.