-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
5140f39
commit 198bdcc
Showing
6 changed files
with
33,632 additions
and
18 deletions.
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"use strict"; | ||
|
||
var bibleData = require("./data/bible.json"); | ||
var abbreviations = require("./utils/abbreviations"); | ||
var _require = require("./utils/validation"), | ||
isValidBook = _require.isValidBook, | ||
isValidChapter = _require.isValidChapter, | ||
isValidVerse = _require.isValidVerse; | ||
function getVerse(bookName, chapterNumber, verseNumber) { | ||
if (!isValidVerse(bookName, chapterNumber, verseNumber)) { | ||
throw new Error('Invalid verse reference'); | ||
} | ||
return bibleData[bookName][chapterNumber][verseNumber - 1]; | ||
} | ||
function getChapter(bookName, chapterNumber) { | ||
if (!isValidChapter(bookName, chapterNumber)) { | ||
throw new Error('Invalid chapter reference'); | ||
} | ||
return bibleData[bookName][chapterNumber]; | ||
} | ||
function getBook(bookName) { | ||
if (!isValidBook(bookName)) { | ||
throw new Error('Invalid book name'); | ||
} | ||
return bibleData[bookName]; | ||
} | ||
function resolveAbbreviation(abbreviation) { | ||
return abbreviations[abbreviation] || abbreviation; | ||
} | ||
module.exports = { | ||
getVerse: getVerse, | ||
getChapter: getChapter, | ||
getBook: getBook, | ||
resolveAbbreviation: resolveAbbreviation | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
"use strict"; | ||
|
||
var abbreviations = { | ||
'Gen': 'Genesis', | ||
'Ex': 'Exodus', | ||
'Lev': 'Leviticus', | ||
'Num': 'Numbers', | ||
'Deu': 'Deuteronomy', | ||
'Jos': 'Joshua', | ||
'Jdg': 'Judges', | ||
'Rut': 'Ruth', | ||
'1Sa': '1 Samuel', | ||
'2Sa': '2 Samuel', | ||
'1Ki': '1 Kings', | ||
'2Ki': '2 Kings', | ||
'1Ch': '1 Chronicles', | ||
'2Ch': '2 Chronicles', | ||
'Ezr': 'Ezra', | ||
'Neh': 'Nehemiah', | ||
'Est': 'Esther', | ||
'Job': 'Job', | ||
'Psa': 'Psalms', | ||
'Pro': 'Proverbs', | ||
'Ecc': 'Ecclesiastes', | ||
'Sng': 'Song of Solomon', | ||
'Isa': 'Isaiah', | ||
'Jer': 'Jeremiah', | ||
'Lam': 'Lamentations', | ||
'Eze': 'Ezekiel', | ||
'Dan': 'Daniel', | ||
'Hos': 'Hosea', | ||
'Joe': 'Joel', | ||
'Amo': 'Amos', | ||
'Oba': 'Obadiah', | ||
'Jnh': 'Jonah', | ||
'Mic': 'Micah', | ||
'Nah': 'Nahum', | ||
'Hab': 'Habakkuk', | ||
'Zeph': 'Zephaniah', | ||
'Hag': 'Haggai', | ||
'Zech': 'Zechariah', | ||
'Mal': 'Malachi', | ||
'Matt': 'Matthew', | ||
'Mark': 'Mark', | ||
'Luk': 'Luke', | ||
'Jhn': 'John', | ||
'Act': 'Acts', | ||
'Rom': 'Romans', | ||
'1Co': '1 Corinthians', | ||
'2Co': '2 Corinthians', | ||
'Gal': 'Galatians', | ||
'Eph': 'Ephesians', | ||
'Phil': 'Philippians', | ||
'Col': 'Colossians', | ||
'1Th': '1 Thessalonians', | ||
'2Th': '2 Thessalonians', | ||
'1Ti': '1 Timothy', | ||
'2Ti': '2 Timothy', | ||
'Tit': 'Titus', | ||
'Phm': 'Philemon', | ||
'Heb': 'Hebrews', | ||
'Jam': 'James', | ||
'1Pe': '1 Peter', | ||
'2Pe': '2 Peter', | ||
'1Jn': '1 John', | ||
'2Jn': '2 John', | ||
'3Jn': '3 John', | ||
'Jude': 'Jude', | ||
'Rev': 'Revelation' | ||
}; | ||
module.exports = abbreviations; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
"use strict"; | ||
|
||
var bibleData = require("../data/bible.json"); | ||
function isValidBook(bookName) { | ||
return bibleData.hasOwnProperty(bookName); | ||
} | ||
function isValidChapter(bookName, chapterNumber) { | ||
if (!isValidBook(bookName)) { | ||
return false; | ||
} | ||
var book = bibleData[bookName]; | ||
return book.hasOwnProperty(chapterNumber); | ||
} | ||
function isValidVerse(bookName, chapterNumber, verseNumber) { | ||
if (!isValidChapter(bookName, chapterNumber)) { | ||
return false; | ||
} | ||
var chapter = bibleData[bookName][chapterNumber]; | ||
return verseNumber >= 1 && verseNumber <= chapter.length; | ||
} | ||
module.exports = { | ||
isValidBook: isValidBook, | ||
isValidChapter: isValidChapter, | ||
isValidVerse: isValidVerse | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters