-
Notifications
You must be signed in to change notification settings - Fork 0
Usage
This page provides detailed information on how to use the various functions provided by the best-bible package.
- getVerse
- getChapter
- getBook
- getRange
- getChapterCount
- getVerseCount
- getBibleBooks
- searchVerse
- resolveAbbreviation
- bibleStats
- bibleValidation
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(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(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(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(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(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()
Retrieves the list of Bible books.
- Returns: Array containing the names of all the Bible books.
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(abbreviation)
Resolves an abbreviation to its full name.
-
Parameters:
-
abbreviation
(string): The abbreviation to resolve.
-
-
Returns: The full name corresponding to the abbreviation.
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.
The bibleValidation
object provides three validation functions:
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.
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.
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.
© 2024 by The-Best-Codes