Skip to content

Commit

Permalink
delete 1 file and update 2 files
Browse files Browse the repository at this point in the history
  • Loading branch information
The-Best-Codes committed Jul 22, 2024
1 parent 5140f39 commit 198bdcc
Show file tree
Hide file tree
Showing 6 changed files with 33,632 additions and 18 deletions.
16 changes: 0 additions & 16 deletions .babelrc

This file was deleted.

33,479 changes: 33,479 additions & 0 deletions dist/data/bible.json

Large diffs are not rendered by default.

35 changes: 35 additions & 0 deletions dist/index.js
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
};
71 changes: 71 additions & 0 deletions dist/utils/abbreviations.js
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;
25 changes: 25 additions & 0 deletions dist/utils/validation.js
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
};
24 changes: 22 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{
"name": "best-bible",
"version": "1.0.4",
"version": "1.0.5",
"description": "Fetch, parse, and analyze the Bible easily with JavaScript",
"scripts": {
"test": "node -r esm test/index.js",
"build:cjs": "cp src/index.js dist/index.cjs.js",
"build:esm": "npx babel src/index.js --out-file dist/index.esm.js --presets @babel/preset-env",
"build:esm": "npx babel src --out-dir dist --presets @babel/preset-env --copy-files",
"build": "npm run build:cjs && npm run build:esm",
"prepublishOnly": "npm run build"
},
Expand Down Expand Up @@ -38,5 +38,25 @@
"esm": "^3.2.25",
"fs": "^0.0.1-security",
"path": "^0.12.7"
},
"babel": {
"presets": [
"@babel/preset-env"
],
"plugins": [
[
"module-resolver",
{
"root": [
"./dist"
],
"alias": {
"./data/bible.json": "./data/bible.json",
"./utils/abbreviations": "./utils/abbreviations",
"./utils/validation": "./utils/validation"
}
}
]
]
}
}

0 comments on commit 198bdcc

Please sign in to comment.