codexparser 0.1.11 → 0.1.14

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 +14 -1
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "codexparser",
3
- "version": "0.1.11",
3
+ "version": "0.1.14",
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": {
@@ -178,7 +178,8 @@ class CodexParser {
178
178
  }
179
179
 
180
180
  // If we hit a semicolon, it means a new reference starts
181
- if (text[i] === ";" || text[i] === " ") {
181
+ // || text[i] === " "
182
+ if (text[i] === ";") {
182
183
  const formattedReference = chapterVerse
183
184
  .trim()
184
185
  .replace(/\./g, ":")
@@ -222,6 +223,7 @@ class CodexParser {
222
223
  i++
223
224
  }
224
225
  }
226
+ dd(this.found)
225
227
  return this // Return this instance for method chaining
226
228
  }
227
229
 
@@ -479,6 +481,17 @@ class CodexParser {
479
481
  },
480
482
  }
481
483
  }
484
+ if (!this.chapterVerses[passage.book][passage.chapter]) {
485
+ return {
486
+ error: true,
487
+ code: 102,
488
+ message: {
489
+ chapter_exists: false,
490
+ content: `Chapter ${passage.chapter} does not exist in ${passage.book}`,
491
+ },
492
+ }
493
+ }
494
+ dd(passage.verses)
482
495
  return true
483
496
  }
484
497
  _handleVersion(version) {