codexparser 0.1.72 → 0.1.73

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/package.json +1 -1
  2. package/src/CodexParser.js +9 -13
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codexparser",
3
- "version": "0.1.72",
3
+ "version": "0.1.73",
4
4
  "description": "This is a Javascript Bible parser and text scanner. It will search through texts and collate all scripture references into an array and parse them into objects, and it will parse passages into objects by book, chapter, verse, and testament. ",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -274,9 +274,6 @@ class CodexParser {
274
274
  parse(reference) {
275
275
  this.scan(reference)
276
276
 
277
- // Define non-abbreviated books per SBL/Crossway
278
- const nonAbbreviatedBooks = ["John", "Luke", "Acts", "Jude", "James", "Titus"]
279
-
280
277
  this.passages = this.found.map((passage) => {
281
278
  const book = this.bookify(passage.book)
282
279
  const testament = this.bible.old.includes(book) ? "old" : "new"
@@ -304,18 +301,17 @@ class CodexParser {
304
301
  parsedPassage.scripture = this.scripturize(parsedPassage)
305
302
  parsedPassage.valid = this._isValid(parsedPassage, passage.reference)
306
303
 
307
- // Set abbr property using SBL-style rules
308
- const abbrKey = Object.keys(this.abbreviations).find(
309
- (abbr) => this.abbreviations[abbr].toLowerCase() === book.toLowerCase()
304
+ // Set abbr property using SBL-style abbreviations
305
+ const sblEntry = Object.entries(this.sblAbbreviations).find(
306
+ ([key]) => key.toLowerCase() === book.toLowerCase()
310
307
  )
311
- if (nonAbbreviatedBooks.includes(book)) {
312
- // Use full book name without period for non-abbreviated books
313
- parsedPassage.abbr = `${book} ${passage.reference}${passage.version ? " " + passage.version : ""}`
314
- } else if (abbrKey) {
315
- // Use abbreviation with period for abbreviated books
316
- parsedPassage.abbr = `${abbrKey}. ${passage.reference}${passage.version ? " " + passage.version : ""}`
308
+ if (sblEntry) {
309
+ const { value, abbr } = sblEntry[1]
310
+ parsedPassage.abbr = abbr
311
+ ? `${value}. ${passage.reference}${passage.version ? " " + passage.version : ""}`
312
+ : `${value} ${passage.reference}${passage.version ? " " + passage.version : ""}`
317
313
  } else {
318
- // Fallback to original if no abbreviation
314
+ // Fallback to original
319
315
  parsedPassage.abbr = parsedPassage.original
320
316
  }
321
317