codexparser 0.1.35 → 0.1.36

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 +20 -4
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codexparser",
3
- "version": "0.1.35",
3
+ "version": "0.1.36",
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": {
@@ -46,7 +46,7 @@ class CodexParser {
46
46
  ]
47
47
  this.chapterVerses = chapter_verses
48
48
  this.error = false
49
- this.version = "eng"
49
+ this.version = null
50
50
  }
51
51
 
52
52
  /**
@@ -228,6 +228,15 @@ class CodexParser {
228
228
  return this // Return this instance for method chaining
229
229
  }
230
230
 
231
+ bibleVersion(version) {
232
+ const lowerVersion = version.toLowerCase()
233
+ this.version =
234
+ lowerVersion === "lxx" || lowerVersion === "eng" || lowerVersion === "bhs" || lowerVersion === "mt"
235
+ ? lowerVersion
236
+ : null
237
+ return this
238
+ }
239
+
231
240
  //TODO: set the version and adjust the versifications
232
241
 
233
242
  /**
@@ -248,6 +257,7 @@ class CodexParser {
248
257
  const book = this.bookify(passage.book)
249
258
  const testament = this.bible.old.find((bible) => bible === book) ? "old" : "new"
250
259
  // Initialize the parsed passage object
260
+
251
261
  const parsedPassage = {
252
262
  original: passage.book + " " + passage.reference,
253
263
  book: book,
@@ -399,8 +409,11 @@ class CodexParser {
399
409
  }
400
410
 
401
411
  _setVersion(passage) {
402
- this.version = passage.version.abbreviation
403
- this._searchVersificationDifferences(passage)
412
+ this.version = passage.version ? passage.version.abbreviation : "eng"
413
+
414
+ if (this.version !== "eng") {
415
+ this._searchVersificationDifferences(passage)
416
+ }
404
417
  }
405
418
 
406
419
  versification() {
@@ -816,8 +829,11 @@ class CodexParser {
816
829
  return true
817
830
  }
818
831
  _handleVersion(version, testament) {
832
+ if (this.version) {
833
+ version = this.version
834
+ }
819
835
  if (!version) {
820
- return null
836
+ version = "eng"
821
837
  }
822
838
  if (version.toLowerCase() === "lxx" && testament.toLowerCase() === "old") {
823
839
  return {